RoadmapShopEvents
Skip to main content

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

FileWriter class

API for interacting with file handles.

Signature:
export declare class FileWriter

Properties

PropertyModifiersTypeDescription
filePathstringThe filePath that was passed to FileWriter.open() .

Methods

MethodModifiersDescription
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(filePath, flags)staticOpens 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().