Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > FileSystem > createWriteStream

FileSystem.createWriteStream() method

Creates a writable stream for writing to a file. Behind the scenes it uses fs.createWriteStream().

Signature:

static createWriteStream(filePath: string, options?: IFileSystemCreateWriteStreamOptions): FileSystemWriteStream;

Parameters

Parameter

Type

Description

filePath

string

The path to the file. The path may be absolute or relative.

options

IFileSystemCreateWriteStreamOptions

(Optional) Optional settings that can change the behavior.

Returns:

FileSystemWriteStream

A new writable stream for the file.

Remarks

Throws an error if the folder doesn't exist, unless IFileSystemWriteFileOptionsBase.ensureFolderExists is set to true.