Question

I modified the Writing to a file example such that I can store some text from an input. I am storing the text aaaaaaaaaa to the file and afterwards the shorter bbbbb to the same file with the same function.

Additionally I am using the Reading a file by name example to read the file. I am getting -- with Chromium 15 -- this result:

bbbbbaaaaa

How can I reset the content of a file? The spec just offers getBlob() and append().

Was it helpful?

Solution

There's a "truncate" method on the FileWriter interface. (It works more like a "setFileSize" method, in that it's possible to "truncate" a file to a larger size than it already has.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top