is-stream
Check if something is a Node.js stream
Last updated 4 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-stream 
SYNC missed versions from official npm registry.

is-stream Build Status

Check if something is a Node.js stream

Install

$ npm install 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

Current Tags

  • 2.0.0                                ...           latest (4 months ago)

4 Versions

  • 2.0.0                                ...           4 months ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 6,606
This Week 141,832
This Month 312,226
Last Day 10,995
Last Week 114,490
Last Month 555,571
Dependencies (0)
None
Dev Dependencies (5)
Dependents (405)

Copyright 2014 - 2016 © taobao.org |