Skip to main content
Version: Next

open

function 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

ParameterTypeDescription

path

string

File path.

options?

OpenOptions

(Optional) Open options, by default is {read: true}. See RsvimFs.OpenOptions.

Returns

Promise<File>

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");