How to Write in file (user directory) using JavaScript?

Viewed 10485

I want to write into txt of any file from chrome(All version) using html5 and javascript or jquery.

I have tried FileSystem API and code I tried is:

function onFs(fs) {
 console.log('test');
  fs.root.getFile('log.txt', {create: true, exclusive: true},
      function(fileEntry) {
        // fileEntry.isFile === true
        // fileEntry.name == 'log.txt'
        // fileEntry.fullPath == '/log.txt'

        fileEntry.getMetaData(function(md) {
          console.log(md.modificationTime.toDateString());
        }, onError);

      },
      onError
  );
}

window.webkitRequestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, onFs);

But not working.

Is there any way to write into the file?

1 Answers
Related