Rush StackShopBlogEvents
Skip to main content

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

FileWriter class

API for interacting with file handles.


export declare class FileWriter 


filePathreadonlystringThe filePath that was passed to


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:\#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().