I've recently encountered this problem, in which I sometimes try to save some data (come configurations, no more than 100 characters in total) in a file using this function fs.writeFile(), but after like 2 or 3 tries, it just stop working, and the function returns false every time...
I also tried to use the E.openFile() and File.close() pattern, but sadly I'm getting the same results. Does anyone else have this problem? I'm using firmware version 1.95 btw
Hmm, 1.95 is old, better upgrade and try again.
Same issue in 2.14. I think the filesystem just crashes silently if there are is not enough heap or too few variables.
A webserver serving multiple files in parallel can crash the filesystem, or a webserver and some other background processes can lead to a crash (using E.pipe).
It doesn't crash by repeated read access, if there's a sufficient free memory available. Storage is much more stable (require('Storage')).
Disclaimer: My experience comes from the ESP8266 with a custom firmware build. Yet, I'm pretty sure there are some undiscovered bugs in the filesystem (require('fs')).
I only use Storage. Can you add a sample to reproduce the crash, or just add infos to https://github.com/espruino/Espruino/issues/1777
For ESP8266 or ESP32? I'm busy atm, but I'll add some specialized code when I find the time to do so.
If you want to run a web server on the ESP8266: https://github.com/GermanWarez/espruino-esp8266-copy-file-to-storage
It'll stop fs when serving two files in parallel. To prevent this I've implemented a sequential loader in index.html. But if you'd request the page in two browser windows in parallel it'll stop fs. Or if you change index.html to contain e.g. it'll stop fs.
Other ways to stop fs:
Hmm, my guess it that you overload the ESP8266. The ESP32 has much more memory and should handle it. Well fs is very memory hungry.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem