Skip to content

f0c1s/node-all-directories

 
 

Repository files navigation

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

About

Get all the directories - node package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%