@yr/readdir
v1.1.2
Published
Readdir utility
Downloads
1
Readme
Readdir utility, with recursive option and filtering
Usage
var readDir = require('readdir')
, path = '/test/'
, dir = readDir(path, true, /\.json$/);
console.log(dir); //=> ['foo.json', 'bar.json', ...]
API
readdir(dir, recursive, filter): Gather all files in 'dir', optionally recursively and filtered by 'filter' regex
readdir('/test', false); //=> Returns array with files in /test directory
readdir('/test/', true); //=> Returns array with files in /test dir and sub-directories.
readdir('/test/', true, /\.json$/); //=> Returns array with all json files found in /test directory and sub-directories