Home > @microsoft/node-core-library > FileWriter

FileWriter class

API for interacting with file handles.

Signature:

export declare class FileWriter 

Methods

Method Modifiers Description
close()   Closes the file handle permanently. No operations can be made on this file handle after calling this. Behind the scenes it uses fs.closeSync() and releases the file descriptor to be re-used.
open(path, flags) static Opens a new file handle to the file at the specified path and given mode. Behind the scenes it uses fs.openSync(). The behaviour of this function is platform specific. See: https://nodejs.org/docs/latest-v8.x/api/fs.html#fs_fs_open_path_flags_mode_callback
write(text)   Writes some text to the given file handle. Throws if the file handle has been closed. Behind the scenes it uses fs.writeSync().