What is the file system module?
fs is a small wrapper over the native file manager for reading, writing, removing, and checking files. By default every path resolves against the platform’s documents directory (the private, persistent folder Unbound stores its data in), so you work with short relative paths instead of absolute ones.
It’s built on the native bridge, and it’s the layer storage and i18n persist through. When you storage.set something, this is what eventually writes it to disk.
Reading & writing
read and write default to utf8. read resolves to the file’s contents; write resolves once the file is on disk. fs.Documents holds the absolute documents path if you need it.
Relative paths resolve against
fs.Documents. To read a file elsewhere on disk, pass an absolute path and false as the inDocuments argument: fs.read('/abs/path', 'utf8', false).Checking & removing
exists tells you whether a file is there; rm deletes it. Both resolve to a boolean.