# fs-vacuum

> recursively remove empty directories -- to a point

Latest version **1.2.10** (published 2017-03-10) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install fs-vacuum
pnpm add fs-vacuum
yarn add fs-vacuum
bun add fs-vacuum
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.10 |
| Published | 2017-03-10 |
| First published | 2014-06-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Forrest L Norvell |
| Maintainers | othiym23, zkat |
| Keywords | rm, rimraf, clean |

## Links

- npm: https://www.npmjs.com/package/fs-vacuum
- Repository: https://github.com/npm/fs-vacuum
- Issues: https://github.com/npm/fs-vacuum/issues
- npm.io page: https://npm.io/package/fs-vacuum

## Dependencies (3)

- [rimraf](https://npm.io/package/rimraf.md) ^2.5.2
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.1.2
- [path-is-inside](https://npm.io/package/path-is-inside.md) ^1.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.10 (latest) — 2017-03-10
- 1.2.9 — 2016-04-21
- 1.2.8 — 2016-04-15
- 1.2.7 — 2015-09-09
- 1.2.6 — 2015-05-21
- 1.2.5 — 2014-12-19
- 1.2.4 — 2014-12-19
- 1.2.3 — 2014-12-19
- 1.2.2 — 2014-11-12
- 1.2.1 — 2014-06-29
- 1.2.0 — 2014-06-29
- 1.1.2 — 2014-06-27
- 1.1.1 — 2014-06-25
- 1.1.0 — 2014-06-25
- 1.0.0 — 2014-06-25

## README

# fs-vacuum

Remove the empty branches of a directory tree, optionally up to (but not
including) a specified base directory. Optionally nukes the leaf directory.

## Usage

```javascript
var logger = require("npmlog");
var vacuum = require("fs-vacuum");

var options = {
  base  : "/path/to/my/tree/root",
  purge : true,
  log   : logger.silly.bind(logger, "myCleanup")
};

/* Assuming there are no other files or directories in "out", "to", or "my",
 * the final path will just be "/path/to/my/tree/root".
 */
vacuum("/path/to/my/tree/root/out/to/my/files", options, function (error) {
  if (error) console.error("Unable to cleanly vacuum:", error.message);
});
```
# vacuum(directory, options, callback)

* `directory` {String} Leaf node to remove. **Must be a directory, symlink, or file.**
* `options` {Object}
  * `base` {String} No directories at or above this level of the filesystem will be removed.
  * `purge` {Boolean} If set, nuke the whole leaf directory, including its contents.
  * `log` {Function} A logging function that takes `npmlog`-compatible argument lists.
* `callback` {Function} Function to call once vacuuming is complete.
  * `error` {Error} What went wrong along the way, if anything.

---
_Source: https://npm.io/package/fs-vacuum · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
