is-stream
Check if something is a Node.js stream
Last updated 8 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 (8 months ago)

4 Versions

  • 2.0.0                                ...           8 months ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 4,176
This Week 163,218
This Month 354,026
Last Day 29,272
Last Week 181,198
Last Month 761,620
Dependencies (0)
None
Dev Dependencies (5)
Dependents (443)

Copyright 2014 - 2016 © taobao.org |