I do have a lot of other code there and I've tried to use memory saving options where possible such as typed arrays.
if you have typed arrays or long strings that are more or less static and read only, you can write it as files to storage. Storage.read returns direct reference to flash memory area so such strings and array constructed from it do not take up RAM.
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 you have typed arrays or long strings that are more or less static and read only, you can write it as files to storage.
Storage.read
returns direct reference to flash memory area so such strings and array constructed from it do not take up RAM.Still there can be even more files on sd card so some API that would enumerate the list in smaller chunks or with callback would be nice. Maybe fs.readdir could return some iterator object? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#iterators