You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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?

    http://www.espruino.com/Reference#l_StorĀ­age_read says:

    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.

About

Avatar for Gordon @Gordon started