folder-reader

2.0.0 • Public • Published

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

Package Sidebar

Install

npm i folder-reader

Weekly Downloads

1

Version

2.0.0

License

ISC

Last publish

Collaborators

  • sethvincent