- Get directories in an array that mimics directory structure.
- Get files.
- Find directories.
npm i node-all-direcotories
var Directory = require('node-all-directories').Directory
var dirs = new Directory()
dirs.walk(/* depth = 1 */)
// dirs.children contains directories on root dir.
const D = require('node-all-directories').Directory
const dirs = new D()
const options = {depth: 4}
const whenFound = (root, tag) => {
console.log(`root: ${root}, found: ${tag}`)
}
const findThese = ['usr', 'home', 'Movies', 'Documents']
dirs.find(findThese, whenFound, options)
If options.depth
to find
is greater than dirs.depth
, then we walk.
IMPORTANT: Callback is necessary to get the output of find
.
MIT
- © 2018 Git Faf
- © 2021 Anubhav