I am playing with the FileSystem API in Google Chrome 16 but can’t write more than once blob (without reopen the file for appending). Seems like the file is closed after the first write.
For example:
var blob = new WebKitBlobBuilder();
blob.append('one');
fileWriter.write(blob.getBlob('text/plain'));
var blob2 = new WebKitBlobBuilder();
blob2.append('two');
fileWriter.write(blob2.getBlob('text/plain'));
gives a _Uncaught Error: INVALID_STATE_ERR: DOM File Exception 7_
The W3 doc says about FileWriter: “This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a single Blob.”
According to the specification, you are not allowed to use a writer when it’s busy writing:
Since the writer is asynchronous, you have to wait using a callback: