Home > @microsoft/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

Parameter Type Description
filePath string The absolute or relative path to the file that should be deleted.
options IFileSystemDeleteFileOptions Optional settings that can change the behavior. Type: IDeleteFileOptions

Returns:

void