fs-directory-stream

Streaming fs.readdir


License
MIT
Install
npm install fs-directory-stream@1.0.1

Documentation

fs-directory-stream

Streaming fs.readdir.

npm install fs-directory-stream

Build Status

Useful if your directory contains a ton of directories 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