0.0.5 • Published 5 years ago

fs-readdir-stream v0.0.5

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

fs-readdir-stream

Is a Function for Recursiv Dir Reading that returns a RealStream for fs.readdir replacement Its using Operating system Filesystem Utils for that and returns a NodeStream or MostStream.

install

npm install --save fs-readdir-stream@0.0.2

Usage

const { findStreamNode, findStreamMost } = require('fs-readdir-stream')
// can also be array supports all options that nativ os find supports
const options = '-maxdepth 1' 

let listing = findStreamNode('.',[options])
listing.stdout.on('data', d=>console.log(d.toString()))
listing.stderr.on('data', d=>console.log(d.toString()))
listing.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});

const readdirStream = findStreamMost('.',[options])
readdirStream(process.cwd()).observe(x=>console.log(x))

Expert Usage

Using the Most Stream Interface https://github.com/cujojs/most/blob/master/docs/api.md

const findStreamMost = require('fs-readdir-stream/find-stream.most')
// can also be array supports all options that nativ os find supports
const options = '-maxdepth 1' 

const readdirStream = findStreamMost('.',[options])
    .observe(x=>console.log(x))

using the Node event Stream Interface

const findStreamNode = require('fs-readdir-stream/find-stream')
// can also be array supports all options that nativ os find supports
const options = '-maxdepth 1' 

const readdirStream = findStreamNode('.',[options])
readdirStream.stdout.on('data', d=>console.log(d.toString()))
readdirStream.stderr.on('data', d=>console.log(d.toString()))
readdirStream.on('close', (code) => {
    console.log(`child process exited with code ${code}`);
});
0.0.5

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago