When I read the reference documentation relating to file I/O, I get the distinct impression that the files are expected to be hosted on a micro SD card. Are there APIs or technologies associated with Espruino that would allow me to "save" files as data flashed to an area of flash memory?
For example, on my ESP8266, I have 4MByte of flash storage but I seem to see that only 500K is actually employed for Espruino. That seems to me that I have 3.5MBytes of unutilized flash memory (at least on some ESP8266 boards). I am looking to have an HTTP server serve up some relatively simple static HTML page and I was thinking that if I could have them "flashed", and if there were some kind of API, then I could serve up the content of these "files" from within an Espruino environment.
Is there some recommended API I should look at? Has anyone walked this path in the past?
That only uses a single page of flash, but could easily be extended to handle multiple pages. What it does do is allow you to use the data directly from flash, without having to load it into RAM first.
There's also the Flash API so you can always access things directly: http://www.espruino.com/Reference#Flash
If you're really bothered about 'named' files you could just write your own JS library to handle a simple filesystem - but FlashEEPROM does contain some fancy stuff to help reduce repeated flash erases for things that change frequently.
Take a look at this
It's a very very simple kind of handling files in flash.
Bad part of the story, its tested on first MB in flash only.
This is because memory mapping of flash to 0x4020000 is used.
Take a look at this:
And - for modules
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