Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

directory-tree-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directory-tree-stream

A streaming directory traverser for node 4 or greater

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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

ParamTypeDescription
rootstringthe 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.

Keywords

directory

FAQs

Package last updated on 13 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts