RsvimFs
The Rsvim.fs global object for file system and file IO.
Example
// Create a alias to 'Rsvim.fs'.
const fs = Rsvim.fs;
Methods
open()
open(path, options?): Promise<File>;
Open a file and resolve to an instance of RsvimFs.File. The file does not need to previously exist if using the create or createNew open options.
The caller have to close the file to prevent resource leaking, see RsvimFs.File.close.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| File path. |
| (Optional) Open options, by default is |
Returns
It resolves to an instance of RsvimFs.File.
Throws
Throws TypeError if any parameters are invalid. Or throws Error if failed to open/create the file.
Example
const file = await Rsvim.fs.open("README.md");
openSync()
openSync(path, options?): File;
The sync version of open.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| Same with open. |
| Same with open. |
Returns
It returns a RsvimFs.File.
Throws
Throws TypeError if any parameters are invalid. Or throws Error if failed to open/create the file.
Example
const file = Rsvim.fs.openSync("README.md");