GithubHelp home page GithubHelp logo

isabella232 / fs-vacuum Goto Github PK

View Code? Open in Web Editor NEW

This project forked from npm/fs-vacuum

0.0 0.0 0.0 125 KB

Remove empty branches in a directory tree.

Home Page: https://npmjs.org/package/fs-vacuum

License: ISC License

JavaScript 100.00%

fs-vacuum's Introduction

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.

fs-vacuum's People

Contributors

helio-frota avatar othiym23 avatar richardlau avatar thefourtheye avatar zkat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.