Skip to content Skip to sidebar Skip to footer

Writing To A File In Javascript Using Filesystem Api

I am trying to write to local file system using FileSystem API in Chrome. I am getting the following error while executing FileError is deprecated. Please use the 'name' or 'mess

Solution 1:

If you're accessing the script locally (via file:///) you'll need to launch Chrome with the '--allow-file-access-from-files'-flag like so:

C:\Path\To\Chrome.exe --allow-file-access-from-files

source, source

If you're doing this within a Chrome app you'll need to add fileSystem-permissions to your manifest.json:

{"manifest_version":2,"name":"...","version":"...","minimum_chrome_version":"23","permissions":[{"fileSystem":["write"]}]}

source

To remove the warning you're getting simply use e.name and/or e.message instead of e.code:

function errorHandler(e) {
    alert(e.name + ": " + e.message);
}

Solution 2:

Seems like your errorHandler wasn't doing anything with msg anyway. Try this:

functionerrorHandler(e) {  console.log("ERROR!: name: [" + e.name + "] message: [" + e.message + "]");  }

Post a Comment for "Writing To A File In Javascript Using Filesystem Api"