Recursively stream a directory of files.
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.
npm install --save folder-reader
var path = require('path')
var reader = require('folder-reader')
var dir = path.join(__dirname, 'docs')
reader(dir).on('data', console.log)
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.
Contributions are welcome! Please read the contributing guidelines first.
It is important that this project contributes to a friendly, safe, and welcoming environment for all. Read this project's code of conduct
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.
- issues – Please open issues in the issues queue
- email – Need in-depth support via paid contract? Send an email to sethvincent@gmail.com