directory-stream

A stream based directory scanner

Directory Stream

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(filenext) {
  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(filenext) {
  next(false, file + "\n")
}));
 
directoryStream.recursive("./target/directory").pipe(lineStream).pipe(process.stdout)