使用PhoneGap创建文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用PhoneGap创建文件相关的知识,希望对你有一定的参考价值。

  1. window.requestFileSystem(
  2. LocalFileSystem.PERSISTENT,
  3. 0,
  4. function doAccess( fs ) {
  5. // alert( 'Got file access' );
  6.  
  7. fs.root.getFile(
  8. SOURCE,
  9. {
  10. create: true,
  11. exclusive: false
  12. },
  13. function( fe ) {
  14. reference = fe.fullPath;
  15. fe.createWriter(
  16. function( writer ) {
  17. // alert( 'Ready to write' );
  18.  
  19. writer.onwriteend = function( e ) {
  20. // alert( 'File written' );
  21. };
  22.  
  23. writer.write( ' ' );
  24. }
  25. );
  26. },
  27. function( err ) {
  28. // alert( 'No access to file entry' );
  29. }
  30. );
  31. },
  32. function( err ) {
  33. // alert( 'File system not responding' );
  34. }
  35. );

以上是关于使用PhoneGap创建文件的主要内容,如果未能解决你的问题,请参考以下文章