Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript Filewriter in FireFox

I need to allow users of my Web App to save files in their local file system after working on an editor implemented with javascript ( to work on a browser ) I heard about FileWriter API in HTML5, but not sure if it is supported in any of the Firefox versions, particularly FireFox 5.

Does anyone have any alternatives apart from Server side processing to allow users to save files into their local filesystem ( ofcourse with a permission from the user ) in FireFox. As I read Google Chrome supports FileWriter API though am not been able to make it work yet.

like image 962
Raks Avatar asked Jan 20 '23 09:01

Raks


2 Answers

FileWriter is a Google working draft

Firefox team is working on implementing FileWriter also: https://bugzilla.mozilla.org/show_bug.cgi?id=557540

like image 125
unxed Avatar answered Jan 29 '23 10:01

unxed


No, Firefox does not support FileWriter, and the standardization of this API was abandoned (1, 2). http://www.w3.org/TR/file-writer-api/ now states:

Work on this document has been discontinued and it should not be referenced or used as a basis for implementation.

It seems that that API didn't even provide the feature you seem to be looking for:

The API doesn't give you access to the local file system, nor is the sandbox really a section of the file system. Instead, it is a virtualized file system that looks like a full-fledged file system to the web app. It does not necessarily have a relationship to the local file system outside the browser.

What this means is that a web app and a desktop app cannot share the same file at the same time. The API does not let your web app reach outside the browser to files that desktop apps can also work on.

You could use localStorage or IndexedDB to store the data client-side, albeit not in an arbitrary file the user can select via filepicker.

You could write an extension that provides the necessary API to content JS. As of 2015, it's unclear which technology you should use for that.

Downloadify (Adobe Flash initiating a download) is also often mentioned when discussing this. This thread mentions an alternative based on data: URIs.

like image 28
Nickolay Avatar answered Jan 29 '23 08:01

Nickolay