It looks like your issue is f.write("a","Hello",0); -Storage assumes that if the offset is 0 you intend to write a new file, so it just creates a new file with 5 characters.
Instead, just combine the first write and you're sorted:
f.write("a","Hello",0,20);
How to determine the size of a file without reading it?
This function returns a String that points to the actual memory area in read-only memory, so it won't use up RAM.
Basically running f.read("a").length is just as efficient as if there were a special-purpose length function, so we just saved some space and left it out.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It looks like your issue is
f.write("a","Hello",0);
-Storage
assumes that if the offset is 0 you intend to write a new file, so it just creates a new file with 5 characters.Instead, just combine the first write and you're sorted:
http://www.espruino.com/Reference#l_Storage_read says:
Basically running
f.read("a").length
is just as efficient as if there were a special-purpose length function, so we just saved some space and left it out.