• Hello
    I would like to use esp8266 as web server and save files on 4mb esp8266 flash.
    what is the best way to save static html/css/js files?

    known way (dont want to write fs implementation on top of it):
    f = require("Flash");
    addr = 0x3C0000; // ESP8266_4MB flashArea[4]
    f.write('ABCD',addr);
    console.log(E.toString(f.read(1,addr)));­
    A
    =undefined

    console.log(E.toString(f.read(1,addr+1))­)
    B
    =undefined

    what is the best way to store files similar to "fs" module?

  • Has anyone tried compiling Espruino with FS enabled? It used to work, but after something like 1.93 it started freezing up the ESP8266 after flashing. I found it was pretty usable still with 1550 JSVars. this would be really a much more elegant solution than the flash storage module.

    Also from looking at the thread, it looks like there are unresolved issues with the flash storage module that were left hanging...

  • I did test compiling the fs module for esp8266 at the time I got the flashfs filesystem working on the esp32. It needs 4K ram for the buffer as this is the size of the block size of the flash. So you do need to reduce the js vars quite a bit.

    Gordon has made some changes that allows js modules to be complied into the firmware, and these don't take up as much space in ram as most of the code stays in flash. So you could compile the modules you need in, so that they will already be available at runtime, so the lack of jsvars might not be as much as an issue.

  • I also tried to the fs module but no good choice for the small ESP8266.

    Now working with native require('flash').write() require('flash').read() calls to save some data when needed.

  • OK, cool. I'll try that out then -- thanks guys :)

  • First take a look at module FlashEEPROM

  • It would appear -- happily -- that the new Storage library in 1v96 solves these problems elegantly. I can even write files out to a lowly ESP-01. Not sure if you've used it yet. :)

  • Yes I use it because the build in module Storage is amazing!

  • Love it :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How to use esp8266 4mb of flash for file storage (html/css/js)?

Posted by Avatar for duplicator @duplicator

Actions