fs-vacuum

recursively remove empty directories -- to a point

This module is no longer maintained
Last updated 8 years ago by zkat .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ npm install fs-vacuum 
SYNC missed versions from official npm registry.

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

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.

Current Tags

  • 1.2.10                                ...           latest (8 years ago)

15 Versions

  • 1.2.10 [deprecated]           ...           8 years ago
  • 1.2.9 [deprecated]           ...           9 years ago
  • 1.2.8 [deprecated]           ...           9 years ago
  • 1.2.7 [deprecated]           ...           9 years ago
  • 1.2.6 [deprecated]           ...           9 years ago
  • 1.2.5 [deprecated]           ...           10 years ago
  • 1.2.4 [deprecated]           ...           10 years ago
  • 1.2.3 [deprecated]           ...           10 years ago
  • 1.2.2 [deprecated]           ...           10 years ago
  • 1.2.1 [deprecated]           ...           10 years ago
  • 1.2.0 [deprecated]           ...           10 years ago
  • 1.1.2 [deprecated]           ...           10 years ago
  • 1.1.1 [deprecated]           ...           10 years ago
  • 1.1.0 [deprecated]           ...           10 years ago
  • 1.0.0 [deprecated]           ...           10 years ago
Maintainers (2)
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (6)

© 2010 - cnpmjs.org x YWFE | Home | YWFE