-
• #2
I'd put them both in one module:
function File() { } File.prototype.foo = ...; exports.createFile = ...; exports.File = File; // ... var myfs=require('FileSystem'); myfs.File.prototype.mySpecialFunction = ...; var file=myfs.createFile('test.txt');
In fact, in a lot of cases you don't actually need access to the
File
class directly, since it'll only be created by things likecreateFile
.If you're doing this, please can you make your API the same as the existing filesystem - specifically the existing
E.openFile
function? It'd make life much easier for everyone.... IMO it'd be ideal if someone could just compile all the existing FAT filesystem code into the ESP8266 port, and then it could even work with external SD cards if needed. While not perfect for flash memory, I'm sure it'd be good enough.
-
• #3
Thanks Gordon.
I used the file analogy as an example.
I'm working on an object store that uses the esp8266 flash. I'm storing the mime types of the objects, as well as the data. This means that css/js/html can all be stored in flash and piped out to an http.response object.I'm intending to have a decent looking ui that is self contained, so that you can connect to the esp8266 as an access point, and then select a wifi ssid, and enter a password to join the network. From there the front end (bootstrap etc) can be delivered via cdn.
I like the idea of having a self contained web server, and with the large flash size on the esp8266, local resources can be stored.
I'll post code once I've got it more refined.
-
• #4
That'd be great to see when you get it done!
I wondering the best way to handle this, and the best way to set modules up for child and parent relationships.
Do we have a single module that contains both the FileSystem and File objects?
I want file to have a reference to it's parent, and have it's own methods.
Should this be set up as two modules, where Filesystem is a list of File objects?
I've not seen any modules that contain two or related classes.