1# fs-vacuum 2 3Remove the empty branches of a directory tree, optionally up to (but not 4including) a specified base directory. Optionally nukes the leaf directory. 5 6## Usage 7 8```javascript 9var logger = require("npmlog"); 10var vacuum = require("fs-vacuum"); 11 12var options = { 13 base : "/path/to/my/tree/root", 14 purge : true, 15 log : logger.silly.bind(logger, "myCleanup") 16}; 17 18/* Assuming there are no other files or directories in "out", "to", or "my", 19 * the final path will just be "/path/to/my/tree/root". 20 */ 21vacuum("/path/to/my/tree/root/out/to/my/files", options, function (error) { 22 if (error) console.error("Unable to cleanly vacuum:", error.message); 23}); 24``` 25# vacuum(directory, options, callback) 26 27* `directory` {String} Leaf node to remove. **Must be a directory, symlink, or file.** 28* `options` {Object} 29 * `base` {String} No directories at or above this level of the filesystem will be removed. 30 * `purge` {Boolean} If set, nuke the whole leaf directory, including its contents. 31 * `log` {Function} A logging function that takes `npmlog`-compatible argument lists. 32* `callback` {Function} Function to call once vacuuming is complete. 33 * `error` {Error} What went wrong along the way, if anything. 34