1.0.1 • Published 6 years ago

fs-directory-stream v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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

1.0.1

6 years ago

1.0.0

6 years ago