Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
664 bytes
|
Line | |
---|
1 | # is-stream [![Build Status](https://travis-ci.org/sindresorhus/is-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/is-stream)
|
---|
2 |
|
---|
3 | > Check if something is a [Node.js stream](https://nodejs.org/api/stream.html)
|
---|
4 |
|
---|
5 |
|
---|
6 | ## Install
|
---|
7 |
|
---|
8 | ```
|
---|
9 | $ npm install --save is-stream
|
---|
10 | ```
|
---|
11 |
|
---|
12 |
|
---|
13 | ## Usage
|
---|
14 |
|
---|
15 | ```js
|
---|
16 | const fs = require('fs');
|
---|
17 | const isStream = require('is-stream');
|
---|
18 |
|
---|
19 | isStream(fs.createReadStream('unicorn.png'));
|
---|
20 | //=> true
|
---|
21 |
|
---|
22 | isStream({});
|
---|
23 | //=> false
|
---|
24 | ```
|
---|
25 |
|
---|
26 |
|
---|
27 | ## API
|
---|
28 |
|
---|
29 | ### isStream(stream)
|
---|
30 |
|
---|
31 | #### isStream.writable(stream)
|
---|
32 |
|
---|
33 | #### isStream.readable(stream)
|
---|
34 |
|
---|
35 | #### isStream.duplex(stream)
|
---|
36 |
|
---|
37 | #### isStream.transform(stream)
|
---|
38 |
|
---|
39 |
|
---|
40 | ## License
|
---|
41 |
|
---|
42 | MIT © [Sindre Sorhus](https://sindresorhus.com)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.