My Goal is to be able to use the ESP32 to serve a React.js or Vue.js single page app. Then use WS to communicate to back to the ESP32. The SPA file will eventually be over 2 Megs. But for now I just want to serve a html file out of the flash file system using the FAT protocol.
When trying to use example code from the espruin0.com/ESP32 page, none of the following works as is shown in the example.
console.log(require( "Flash").getFree());
var fs = require("fs");
if ( typeof(fs.readdirSync()) === 'undefined' ) {
}
fs.writeFileSync("hello.txt", "Hello World");
console.log(fs.readFileSync("hello.txt")); // prints "Hello World"
fs.appendFileSync("hello.txt", "!!!");
console.log(fs.readFileSync("hello.txt")); // prints "Hello World!!!"
The results I get are:
For the "console.log(require( "Flash").getFree());" command:
[
{ "addr": 1114112, "length": 3080191 }
]
For the rest of the code:
Uncaught Error: Unable to mount media : NO_FILESYSTEM
at line 6 col 28
if ( typeof(fs.readdirSync()) === 'undefined' ) {
I am relatively new so there is a strong chance I am doing something wrong.
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.
My Goal is to be able to use the ESP32 to serve a React.js or Vue.js single page app. Then use WS to communicate to back to the ESP32. The SPA file will eventually be over 2 Megs. But for now I just want to serve a html file out of the flash file system using the FAT protocol.
When trying to use example code from the espruin0.com/ESP32 page, none of the following works as is shown in the example.
console.log(require( "Flash").getFree());
var fs = require("fs");
if ( typeof(fs.readdirSync()) === 'undefined' ) {
}
fs.writeFileSync("hello.txt", "Hello World");
console.log(fs.readFileSync("hello.txt")); // prints "Hello World"
fs.appendFileSync("hello.txt", "!!!");
console.log(fs.readFileSync("hello.txt")); // prints "Hello World!!!"
The results I get are:
For the "console.log(require( "Flash").getFree());" command:
[
{ "addr": 1114112, "length": 3080191 }
]
For the rest of the code:
Uncaught Error: Unable to mount media : NO_FILESYSTEM
at line 6 col 28
if ( typeof(fs.readdirSync()) === 'undefined' ) {
I am relatively new so there is a strong chance I am doing something wrong.