Rush StackShopBlogEvents
Skip to main content

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

FileSystem.deleteFile() method

Deletes a file. Can optionally throw if the file doesn't exist. Behind the scenes it uses fs.unlinkSync().

Signature:

static deleteFile(filePath: string, options?: IFileSystemDeleteFileOptions): void;

Parameters

ParameterTypeDescription
filePathstringThe absolute or relative path to the file that should be deleted.
optionsIFileSystemDeleteFileOptions(Optional) Optional settings that can change the behavior. Type: IDeleteFileOptions

Returns:

void