Skip to content

Awpatterson217/tree-trav

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

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

Resources

License

Stars

1 star

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors