node-all-directories
v13.0.0
Published
Get all the directories - node package
Downloads
3
Readme
node-all-directories
v13 (current version)
Dependencies
Features
- Get directories in an array that mimics directory structure.
- Get files.
- Find directories.
Installation
npm i node-all-direcotories
Usage
Walk through file system
var Directory = require('node-all-directories').Directory
var dirs = new Directory()
dirs.walk(/* depth = 1 */)
// dirs.children contains directories on root dir.
Find directories
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
.
License
MIT
- © 2018 Git Faf
- © 2021 Anubhav