tree-trav
v1.0.4
Published
A library to handle nested directory structures in Node.js using the EventEmitter API and recursion.
Downloads
8
Maintainers
Readme
tree-trav
A library to handle nested directory structures in Node.js using the EventEmitter API and recursion.
npm install tree-trav
Example Usage:
const Tree = require('tree-trav').Tree;
let myTree = new Tree();
let stylesheets = [];
let jsFiles = [];
// Find all CSS and js files in a
// nested file structure
myTree.getLeaves('example/root/', [
'.css',
'.js'
]);
// Deal with files as they are found
myTree.on('file', (file, dir, extension) =>{
if(extension === '.js')
jsFiles.push(file);
if(extension === '.css')
stylesheets.push(file);
});