• I am trying out the Sorage module. The example in the documentation works fine on my board. However a small change in the code brought me to a problem:
    I would start with an empty file of the required size and then populate the file with content:

    var f = require("Storage");
    f.write("a", "", 0, 20);
    console.log("File-Size: ", f.read("a").length);
    f.write("a","Hello",0);
    f.write("a"," ",5);
    f.write("a","World!!!",6);
    print(f.read("a"));
    

    This results in an error:

    File-Size:  14
    Uncaught Error: Too much data for file size
     at line 1 col 18
    f.write("a"," ",5);
                     ^
    Uncaught Error: Too much data for file size
     at line 1 col 25
    f.write("a","World!!!",6);
                            ^
    Hello
    

    And another question: How to determine the size of a file without reading it? The file might be bigger than the available memory and the "list()" method just lists the file name.

About

Avatar for fanThomas @fanThomas started