## Usage ```js const deleteEmpty = require('{%= name %}'); ``` ## API Given the following directory structure, the **highlighted directories** would be deleted. ```diff foo/ └─┬ a/ - ├── aa/ ├── bb/ │ └─┬ bbb/ │ │ ├── one.txt │ │ └── two.txt - ├── cc/ - ├ b/ - └ c/ ``` ### async-await (promise) If no callback is passed, a promise is returned. Returns the array of deleted directories. ```js (async () => { let deleted = await deleteEmpty('foo'); console.log(deleted); //=> ['foo/aa/', 'foo/a/cc/', 'foo/b/', 'foo/c/'] })(); // or deleteEmpty('foo/') .then(deleted => console.log(deleted)) //=> ['foo/aa/', 'foo/a/cc/', 'foo/b/', 'foo/c/'] .catch(console.error); ``` ### async callback Returns the array of deleted directories in the callback. ```js deleteEmpty('foo/', (err, deleted) => { console.log(deleted); //=> ['foo/aa/', 'foo/a/cc/', 'foo/b/', 'foo/c/'] }); ``` ### sync Returns the array of deleted directories. ```js console.log(deleteEmpty.sync('foo/')); //=> ['foo/aa/', 'foo/a/cc/', 'foo/b/', 'foo/c/'] ``` ## CLI To use the `delete-empty` command from any directory you must first install the package globally with the following command: ```sh $ npm install --global delete-empty ``` **Usage** ``` Usage: $ delete-empty [options] Directory: (optional) Initial directory to begin the search for empty directories. Otherwise, cwd is used. [Options]: -c, --cwd Set the current working directory for folders to search. -d, --dryRun Do a dry run without deleting any files. -h, --help Display this help menu -V, --version Display the current version of rename -v, --verbose Display all verbose logging messages (currently not used) ```