aswi2020vldc-gitlab/templetes/node_modules/is-stream/readme.md @ 9bb1e829
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) |
- « Předchozí
- 1
- 2
- 3
- 4
- Další »