remove-dir-safe
v2.0.0
Published
Remove directories recursively or non-recursively
Downloads
1,724
Maintainers
Readme
Remove directories recursively or non-recursively.
- Returns
true
if directory no longer exists. - Returns
false
if unable to remove directory. - Returns
undefined
on other errors (ex: permission denied) rather than throwing.
Unless the unsafe
flag is set, only directories inside the current working directory or OS temp directory will be removed.
Installation
yarn add remove-dir-safe
npm install remove-dir-safe
API
import { removeDir, removeDirSync, Options } from "write-dir-safe";
function removeDir(path: string, options: Options): Promise<boolean | undefined>;
function removeDirSync(path: string, options: Options): boolean | undefined;
type Options = {
/**
* If true, perform a recursive directory removal. Default: `true`
*/
recursive?: boolean;
/**
* Allow removals outside of current working directory, or OS temp directory. Default: `false`
*/
unsafe?: boolean;
}
- is-path-inside: Check if a path is inside another path
- @bconnorwhite/bob: Bob is a toolkit for TypeScript projects
- @types/mock-fs: TypeScript definitions for mock-fs
- @types/node: TypeScript definitions for Node.js
- mock-fs: A configurable mock file system. You know, for testing.