folder-walker
A recursive stream of the files and directories in a given folder. Can take multiple folders.
Install
npm install folder-walker
Example
var walker = require('folder-walker')
var stream = walker(['/path/to/folder', '/another/folder/here'])
stream.on('data', function (data) {
console.log(data)
})
Example item in the stream:
{
basename: 'index.js',
relname: 'test/index.js',
root: '/Users/karissa/dev/node_modules/folder-walker',
filepath: '/Users/karissa/dev/node_modules/folder-walker/test/index.js',
stat: [fs.Stat Object],
type: 'file'
}
API
stream = walker(dirs, [opts])
Create a readable object stream of all files and folders inside of dirs
.
dirs
can be a path to a directory or an array of paths to directories.
opts
includes:
{
fs: require('fs'),
maxDepth: Infinity
filter: function (filename) { return true }
}