Skip to content

gachou/directory-tree-stream

Repository files navigation

directory-tree-stream

NPM version Travis Build Status Coverage Status

A streaming directory traverser for node 4 or greater

Installation

npm install directory-tree-stream

Usage

The following example demonstrates how to use this module:

const dirTreeStream = require('directory-tree-stream')
const es = require('event-stream')

// Read tree with the directory of this script (__dirname) as root-directory
dirTreeStream(__dirname)
  // file.stat contains the fs.Stats object
  // file.path contains the path, relative to the root directory
  .pipe(es.mapSync((file) => `${file.stat.mode} ${file.path}\n`))
  .pipe(process.stdout)

This will generate the following output

16893 
16893 subdir
33204 subdir/file.txt
33204 example.js

API-reference

directoryTreeStream(root)

Creates an instance of stream.Readable that emits all files and directories of a given directory tree (recursively)

Kind: global function
Access: public

Param Type Description
root string the root directory

License

directory-tree-stream is published under the MIT-license. See LICENSE.md for details.

Release-Notes

For release notes, see CHANGELOG.md

Contributing guidelines

See CONTRIBUTING.md.

About

A streaming directory traverser for node 4 or greater

Resources

License

Stars

Watchers

Forks

Packages

No packages published