Check if something is a Node.js stream
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig minor tweaks Apr 12, 2016
.gitattributes
.gitignore init Jan 18, 2015
.travis.yml
index.js ES2015ify and require Node.js 4 Mar 29, 2017
license init Jan 18, 2015
package.json ES2015ify and require Node.js 4 Mar 29, 2017
readme.md ES2015ify and require Node.js 4 Mar 29, 2017
test.js ES2015ify and require Node.js 4 Mar 29, 2017

readme.md

is-stream Build Status

Check if something is a Node.js stream

Install

$ npm install --save is-stream

Usage

const fs = require('fs');
const isStream = require('is-stream');

isStream(fs.createReadStream('unicorn.png'));
//=> true

isStream({});
//=> false

API

isStream(stream)

Returns a boolean for whether it's a Stream.

isStream.writable(stream)

Returns a boolean for whether it's a stream.Writable.

isStream.readable(stream)

Returns a boolean for whether it's a stream.Readable.

isStream.duplex(stream)

Returns a boolean for whether it's a stream.Duplex.

isStream.transform(stream)

Returns a boolean for whether it's a stream.Transform.

Related

License

MIT © Sindre Sorhus