|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.6 KB
|
| Rev | Line | |
|---|
| [9af201e] | 1 | # is-stream
|
|---|
| 2 |
|
|---|
| 3 | > Check if something is a [Node.js stream](https://nodejs.org/api/stream.html)
|
|---|
| 4 |
|
|---|
| 5 | ## Install
|
|---|
| 6 |
|
|---|
| 7 | ```
|
|---|
| 8 | $ npm install is-stream
|
|---|
| 9 | ```
|
|---|
| 10 |
|
|---|
| 11 | ## Usage
|
|---|
| 12 |
|
|---|
| 13 | ```js
|
|---|
| 14 | const fs = require('fs');
|
|---|
| 15 | const isStream = require('is-stream');
|
|---|
| 16 |
|
|---|
| 17 | isStream(fs.createReadStream('unicorn.png'));
|
|---|
| 18 | //=> true
|
|---|
| 19 |
|
|---|
| 20 | isStream({});
|
|---|
| 21 | //=> false
|
|---|
| 22 | ```
|
|---|
| 23 |
|
|---|
| 24 | ## API
|
|---|
| 25 |
|
|---|
| 26 | ### isStream(stream)
|
|---|
| 27 |
|
|---|
| 28 | Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
|---|
| 29 |
|
|---|
| 30 | #### isStream.writable(stream)
|
|---|
| 31 |
|
|---|
| 32 | Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
|---|
| 33 |
|
|---|
| 34 | #### isStream.readable(stream)
|
|---|
| 35 |
|
|---|
| 36 | Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
|---|
| 37 |
|
|---|
| 38 | #### isStream.duplex(stream)
|
|---|
| 39 |
|
|---|
| 40 | Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
|---|
| 41 |
|
|---|
| 42 | #### isStream.transform(stream)
|
|---|
| 43 |
|
|---|
| 44 | Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
|---|
| 45 |
|
|---|
| 46 | ## Related
|
|---|
| 47 |
|
|---|
| 48 | - [is-file-stream](https://github.com/jamestalmage/is-file-stream) - Detect if a stream is a file stream
|
|---|
| 49 |
|
|---|
| 50 | ---
|
|---|
| 51 |
|
|---|
| 52 | <div align="center">
|
|---|
| 53 | <b>
|
|---|
| 54 | <a href="https://tidelift.com/subscription/pkg/npm-is-stream?utm_source=npm-is-stream&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|---|
| 55 | </b>
|
|---|
| 56 | <br>
|
|---|
| 57 | <sub>
|
|---|
| 58 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|---|
| 59 | </sub>
|
|---|
| 60 | </div>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.