tree-trav

1.0.4 • Public • Published

tree-trav

A library to handle nested directory structures in Node.js using the EventEmitter API and recursion.

npm version npm version npm version



npm install tree-trav

Tree API Documentation

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

Contributors Welcome!

Package Sidebar

Install

npm i tree-trav

Weekly Downloads

2

Version

1.0.4

License

(MIT OR Apache-2.0)

Last publish

Collaborators

  • awpatterson217