readTextFile
function readTextFile(path): Promise<string>;
Read a file in text mode, i.e. into a string, without open/close a file descriptor/handle.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| File path to read. |
Returns
Promise<string>
It resolves to text string that contains all the file contents.
Throws
Throws TypeError if the file name is invalid. Or throws Error if failed to read the file.
Example
const payload = await Rsvim.fs.readTextFile("README.md");