Socket
Socket
Sign inDemoInstall

fs-vacuum

Package Overview
Dependencies
14
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fs-vacuum

recursively remove empty directories -- to a point


Version published
Weekly downloads
174K
decreased by-4.83%
Maintainers
2
Install size
231 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 10 Mar 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc