Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

readdirfiles

1.2.1 • Public • Published

readdirfiles

Node.js' fs.readdir + fs.readFile.

Usage

$ mkdir numbers
$ echo "one" > numbers/1
$ echo "two" > numbers/2
$ echo "three" > numbers/3
$ npm install readdirfiles
(...)
$ node
> let readdirFiles = require('readdirfiles')
undefined
> readdirFiles('numbers', 'utf8', function (err, files) { console.dir(files) })
undefined
> [ { path: 'numbers/1', content: 'one\n' },
  { path: 'numbers/2', content: 'two\n' },
  { path: 'numbers/3', content: 'three\n' } ]
> /*
... There's a ReadableStream too if you want:
... var rs = new readdirFiles.Stream('numbers', 'utf8')
... */
undefined

install

npm i readdirfiles

Downloadsweekly downloads

9

version

1.2.1

license

Fair

repository

githubgithub

last publish

collaborators

  • avatar