fs-directory-stream

Streaming fs.readdir

MIT License

Downloads
16
Stars
47

fs-directory-stream

Streaming fs.readdir.

npm install fs-directory-stream

Useful if your directory contains a ton of directories/files and you don't want to read them all into ram at once.

Usage

var createDirectoryStream = require('fs-directory-stream')

createDirectoryStream('/home/maf/dev/node_modules')
  .on('data', data => console.log(data))
  .on('end', () => console.log('(no more data)'))

Uses uv_fs_scandir_next behind the scenes to perform the streaming readdir.

API

var readableStream = createDirectoryStream(path)

Make a new stream of directory entries. Will emit an error if path doesn't exist, etc.

Every data event is the string name of a directory entry.

License

MIT

Package Rankings
Top 20.04% on Npmjs.org
Badges
Extracted from project README
Build Status