node/deps/npm/node_modules/fs-vacuum
Rebecca Turner 5c36cfc843 deps: upgrade npm to 3.8.9
Contains the following three npm releases:
https://github.com/npm/npm/releases/tag/v3.8.7
https://github.com/npm/npm/releases/tag/v3.8.8
https://github.com/npm/npm/releases/tag/v3.8.9

PR-URL: https://github.com/nodejs/node/pull/6664
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-05-10 14:45:28 -04:00
..
test deps: upgrade npm to 3.8.9 2016-05-10 14:45:28 -04:00
.eslintrc deps: upgrade npm to 2.0.0 2014-09-24 17:15:10 -07:00
.npmignore deps: upgrade npm to 2.0.0 2014-09-24 17:15:10 -07:00
.travis.yml deps: upgrade npm to 3.8.9 2016-05-10 14:45:28 -04:00
LICENSE deps: upgrade npm to 2.11.0 2015-05-30 08:15:11 -04:00
package.json deps: upgrade npm to 3.8.9 2016-05-10 14:45:28 -04:00
README.md deps: upgrade npm to 2.0.0 2014-09-24 17:15:10 -07:00
vacuum.js deps: upgrade npm to 3.8.9 2016-05-10 14:45:28 -04:00

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", 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.