Skip to content

Latest commit

 

History

History
96 lines (48 loc) · 1.56 KB

File metadata and controls

96 lines (48 loc) · 1.56 KB
hide_title true
custom_edit_url
pagination_prev
pagination_next

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

FileSystem.appendToFile() method

Writes a text string to a file on disk, appending to the file if it already exists. Behind the scenes it uses fs.appendFileSync()<></>.

Signature:

static appendToFile(filePath: string, contents: string | Buffer, options?: IFileSystemWriteFileOptions): void;

Parameters

Parameter

Type

Description

filePath

string

The absolute or relative path of the file.

contents

string | Buffer

The text that should be written to the file.

options

IFileSystemWriteFileOptions

(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<></>.