Filesystem Library
Stof filesystem library ("fs").
Last updated
Was this helpful?
Stof filesystem library ("fs").
Last updated
Was this helpful?
The filesystem library is a part of Stof, however, is separately organized because it is system-dependent and cannot (and should not) be broadly implemented for all embedded environments.
All Stof filesystem calls go through this library though, so if this library is replicated or added in other environments, those features of Stof will work (primarily import statements). For example, in TypeScript, server environments (like Deno or Node.js) have filesystem calls that can be used to give Stof access to filesystem resources, but must do so explicitly (Stof is meant to be in the dark by default).
Will create a text file at the given path with the provided contents if it does not exist and will entirely replace its contents if it does.
Will create a binary file at the given path with the provided blob content if it does not exist and will entirely replace its contents if it does.
Reads a text file into a string. Will throw an error if the file does not exist.
Reads a binary file into a blob. Will throw an error if the file does not exist.