@yr/readdir

1.1.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @yr/readdir

Weekly Downloads

1

Version

1.1.2

License

MIT

Last publish

Collaborators

  • yr
  • saegrov