sethvincent / folder-reader

Create a stream that outputs the contents of a set of directories recursively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

folder-reader

Recursively stream a directory of files.

npm travis standard conduct

About

Recursively read all files/directories in a set of directories.

Creates a stream that outputs objects with file content and metadata.

Example item in the stream:

{
  basename: 'index.js',
  relname: 'tests/index.js',
  root: '/Users/sdv/workspace/sethvincent/folder-reader',
  filepath: '/Users/sdv/workspace/sethvincent/folder-reader/tests/index.js',
  stat: [fs.Stat Object],
  type: 'file' // or 'directory',
  file: '' // the contents of the file
}

Based on the folder-walker module.

Install

npm install --save folder-reader

Usage

var path = require('path')
var reader = require('folder-reader')

var dir = path.join(__dirname, 'docs')
reader(dir).on('data', console.log)

Using alternate fs implementations

You can use this module with alternate fs implementations like hyperdrive by passing the alternate fs as an option:

var reader = require('folder-reader')
var hyperdrive = require('hyperdrive')

var drive = hyperdrive('./drive')

reader('/some/dir', { fs: drive })

See a more detailed example of using this module with hyperdrive.

Documentation

Examples

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Conduct

It is important that this project contributes to a friendly, safe, and welcoming environment for all. Read this project's code of conduct

Changelog

Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Contact

License

ISC

About

Create a stream that outputs the contents of a set of directories recursively

License:ISC License


Languages

Language:JavaScript 100.0%