No problem - I'm happy to help out and it's good to have someone pushing things. I just need enough information to be able to help out :)
So... I just copied the 'read file' code from the Web IDE and added it to your example:
function go() {
console.log("writing");
var i = 10000;
var file = require("Storage").open("test", "w");
while (i > 0){
var sentence = "Long string of gibberish ";
file.write(sentence);
i--;
}
file = null;
console.log("reading");
var f = require("Storage").open("test","r");
var d = f.read(384);
while (d!==undefined) {
console.log(btoa(d));
d = f.read(384);
}
}
And that appears to work fine too, as does the IDE's 'load file' menu (ish). The IDE file loading itself works fine, but the file takes so long to download that the IDE times out waiting for it all to come in and then the IDE didn't handle that very well. I've just made some tweaks (not published yet) which will at least output a proper error in the case that that happens...
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.
No problem - I'm happy to help out and it's good to have someone pushing things. I just need enough information to be able to help out :)
So... I just copied the 'read file' code from the Web IDE and added it to your example:
And that appears to work fine too, as does the IDE's 'load file' menu (ish). The IDE file loading itself works fine, but the file takes so long to download that the IDE times out waiting for it all to come in and then the IDE didn't handle that very well. I've just made some tweaks (not published yet) which will at least output a proper error in the case that that happens...