If I run this code on a cleaned up Bangle watch, it seems to throw a file too big error eventually and the file size reported is ~ 1Mb. Am I doing something wrong to not be able to write on beyond 1Mb ?
(** BEWARE: starts with Storage.eraseAll() ** )
function repro() {
require("Storage").eraseAll();
var file = require("Storage").open("testfile.log", "a");
try
{
while (true){
var sentence = "Long string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberish\n";
file.write(sentence);
}
}
catch(ex){
console.log(ex);
console.log("File size after write error: " + file.getLength());
file = null;
}
}
repro();
>Error: Error: File too big!
File size after write error: 1036320
L8 is most likely queued up multiple times before the first write occurs and is allowed to finish, cleaning up file I/O overhead. Maybe try a callback strategy, rather than relying on an error detection scheme?
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.
If I run this code on a cleaned up Bangle watch, it seems to throw a
file too big error
eventually and the file size reported is ~ 1Mb. Am I doing something wrong to not be able to write on beyond 1Mb ?(** BEWARE: starts with Storage.eraseAll() ** )
Following are my env details
My fork was last synced with upstream on March 1, so I am wee bit behind. Apologies if this is causing the issue.
Update: Just to clarify, I was expecting the File write to error out after ~4Mb which is the max capacity of the BangleJS.