Home

Awesome

is-node-stream npmjs.com The MIT License

Strictly and correctly checks if value is a nodejs stream.

code climate standard code style travis build status coverage status dependency status

Install

npm i is-node-stream --save

Usage

For more use-cases see the tests

var stream = require('stream')
var isNodeStream = require('is-node-stream')

isNodeStream(val) returns true when

isNodeStream(new stream.Stream())
isNodeStream(new stream.Duplex())
isNodeStream(new stream.Readable())
isNodeStream(new stream.Writable())
isNodeStream(new stream.Transform())
isNodeStream(new stream.PassThrough())
isNodeStream(new net.Socket())
isNodeStream(fs.createReadStream('package.json'))

isNodeStream.readable(val) returns true when

isNodeStream.readable(process.stdin)
isNodeStream.readable(new stream.Duplex())
isNodeStream.readable(new stream.Readable())
isNodeStream.readable(new stream.Transform())
isNodeStream.readable(new stream.PassThrough())
isNodeStream.readable(fs.createReadStream('package.json'))

isNodeStream.writable(val) returns true when

isNodeStream.writable(process.stdout)
isNodeStream.writable(new stream.Duplex())
isNodeStream.writable(new stream.Writable())
isNodeStream.writable(new stream.Transform())
isNodeStream.writable(new stream.PassThrough())
isNodeStream.writable(fs.createWriteStream('foobar'))

isNodeStream.duplex(val) returns true when

isNodeStream.duplex(new stream.Duplex())
isNodeStream.duplex(new stream.Transform())
isNodeStream.duplex(new stream.PassThrough())

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github