directory-stream

A stream based directory scanner

npm install directory-stream
2 downloads in the last week
9 downloads in the last month

Directory Stream

Build Status

This module provides a streaming interface for scanning directories. It is capable of scanning a single level of a directory as well as recursively scanning directories. It also ships with async and sync flavors.

Scanning a single level directory

var directoryStream = require("directory-stream")
var eventStream     = require("event-stream")

lineStream = eventStream.map(function(file, next) {
  next(false, file + "\n")
}));

directoryStream("./target/directory").pipe(lineStream).pipe(process.stdout)

Scanning a nested directories recursively

var directoryStream = require("directory-stream")
var eventStream     = require("event-stream")

lineStream = eventStream.map(function(file, next) {
  next(false, file + "\n")
}));

directoryStream.recursive("./target/directory").pipe(lineStream).pipe(process.stdout)
npm loves you