REserve/fs
File system mapper for REserve. It makes Node.js' fs APIs available in the browser.
Usage
- In the mapping :
- In the HTML page :
- In JavaScript :
fs
Options
Option | Default Value | Explanation |
---|---|---|
client-name |
'fs' |
Name of the member added to the browser window |
read-only |
false |
Forbids write methods if true |
All APIs are restricted to the scope of the path configured in the mapping. Any attempt to read or write elsewhere will lead to a 403
error.
Supported APIs
The following APIs are supported. A promisified version of each method is provided under the same name suffixed with Async
(for instance: fs.readdirAsync
).
- read-only
fs.readdir
fs.readFile
: the returned data is converted to textfs.stat
- read/write
fs.mkdir
fs.rmdir
fs.unlink
fs.writeFile
:file
must be a file name,data
is a string