Skip to content

Latest commit

 

History

History
98 lines (49 loc) · 1.7 KB

File metadata and controls

98 lines (49 loc) · 1.7 KB
hide_title true
custom_edit_url
pagination_prev
pagination_next

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

FileSystem.writeBuffersToFile() method

Writes the contents of multiple Uint8Arrays to a file on disk, overwriting the file if it already exists. Behind the scenes it uses fs.writevSync()<></>.

This API is useful for writing large files efficiently, especially if the input is being concatenated from multiple sources.

Signature:

static writeBuffersToFile(filePath: string, contents: ReadonlyArray<NodeJS.ArrayBufferView>, options?: IFileSystemWriteBinaryFileOptions): void;

Parameters

Parameter

Type

Description

filePath

string

The absolute or relative path of the file.

contents

ReadonlyArray<NodeJS.ArrayBufferView>

The content that should be written to the file.

options

IFileSystemWriteBinaryFileOptions

(Optional) Optional settings that can change the behavior.

Returns:

void

Remarks

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