1.0.4 • Published 7 years ago

tree-trav v1.0.4

Weekly downloads
2
License
(MIT OR Apache-2....
Repository
github
Last release
7 years ago

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);
});