File

Overview

Static methods

Promise(string)

readAllTextAsync(string path)

Promise(void)

writeAllTextAsync(string path, string text)

Details

Static methods

Promise(string) readAllTextAsync(string path)


Returns: a promise that is fulfilled with the file’s text contents on success, and rejected with an error on failure.

Promise(void) writeAllTextAsync(string path, string text)


If the file does not exist, it is created. If it already exists, its contents are overwritten.

Returns: a promise that is fulfilled on success, and rejected with an error on failure.

Example

const { File } = require("inputactions/fs");

File.writeAllTextAsync("/tmp/test", "test")
    .then(() => console.log("success"))
    .catch(error => console.error(error));