delete-directory-recursive

1.0.0 • Public • Published

delete-directory-recursive

Deletes the directory recursively, by reading the contents of the directory as a stream to read. Suitable for deleting directory contents with millions of files.

Install

$ npm i delete-directory-recursive

Usage

const deleteDir=require('delete-directory-recursive');
 
const fileHandler=absolutePath => {
    console.log(`This file/dir is deleted: ${absolutePath}`);
};
 
deleteDir({root: '/path/to/dir', fileHandler})
    .then(() => {
        console.log('directory deleted');
    });

Options

  • root - absolute path to dir.
  • fileHandler - a function in which an absolute path is passed to each file or folder that was deleted. Optional parameter.

Usage in console

$ node delete --root="/path/to/dir"

Readme

Keywords

none

Package Sidebar

Install

npm i delete-directory-recursive

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.37 kB

Total Files

4

Last publish

Collaborators

  • makc.brain