This commit is contained in:
Gordon Williams 2018-04-10 08:36:03 +01:00
parent 05277faaf1
commit d71c82c012

View File

@ -603,9 +603,11 @@ Before first use the media needs to be formatted.
```
fs=require("fs");
if ( typeof(fs.readdirSync())==="undefined" ) {
console.log("Formatting FS");
E.flashFatFS({format:true});
try {
fs.readdirSync();
} catch (e) { //'Uncaught Error: Unable to mount media : NO_FILESYSTEM'
console.log('Formatting FS - only need to do once');
E.flashFatFS({ format: true });
}
fs.writeFileSync("bang.txt", "This is the way the world ends\nnot with a bang but a whimper.\n");
fs.readdirSync();