$ gnpm install remove-file-safe
Remove files without try catch.
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
Remove files without try catch.
true
if file no longer exists.false
if unable to remove file.undefined
on other errors (ex: permission denied) rather than throwing.Unless the unsafe
flag is set, only files inside the current working directory or OS temp directory will be removed.
yarn add remove-file-safe
npm install remove-file-safe
pnpm add remove-file-safe
import { removeFile, removeFileSync, Options } from "remove-file-safe";
function removeFile(path: string, options?: Options): Promise<boolean | undefined>;
function removeFileSync(path: string, options?: Options): boolean | undefined;
type Options = {
/**
* Allow removals outside of current working directory, or OS temp directory. Default: `false`
*/
unsafe?: boolean;
};
Copyright 2013 - present © cnpmjs.org | Home |