🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@hyperse/delete-empty-folders

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperse/delete-empty-folders

Recursively delete all empty folders in a directory and child directories.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

@hyperse/delete-empty-folders

build stable version GitHub top language Licence

Recursively delete all empty folders in a directory and child directories.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

(TOC generated by verb using markdown-toc)

Install

Install with npm:

$ npm install --save @hyperse/delete-empty-folders

Usage

import { deleteEmpty, deleteEmptySync } from '@hyperse/delete-empty-folders';

API

Given the following directory structure, the highlighted directories would be deleted.

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.

(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);

sync

Returns the array of deleted directories.

console.log(deleteEmptySync('foo/')); //=> ['foo/aa/', 'foo/a/cc/', 'foo/b/', 'foo/c/']

Keywords

hyperse

FAQs

Package last updated on 12 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts