]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/fs-vacuum/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / fs-vacuum / README.md
1 # fs-vacuum
2
3 Remove the empty branches of a directory tree, optionally up to (but not
4 including) a specified base directory. Optionally nukes the leaf directory.
5
6 ## Usage
7
8 ```javascript
9 var logger = require("npmlog");
10 var vacuum = require("fs-vacuum");
11
12 var 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  */
21 vacuum("/path/to/my/tree/root/out/to/my/files", 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.