| 1 | import * as stream from 'stream';
|
|---|
| 2 |
|
|---|
| 3 | declare const isStream: {
|
|---|
| 4 | /**
|
|---|
| 5 | @returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
|---|
| 6 |
|
|---|
| 7 | @example
|
|---|
| 8 | ```
|
|---|
| 9 | import * as fs from 'fs';
|
|---|
| 10 | import isStream = require('is-stream');
|
|---|
| 11 |
|
|---|
| 12 | isStream(fs.createReadStream('unicorn.png'));
|
|---|
| 13 | //=> true
|
|---|
| 14 |
|
|---|
| 15 | isStream({});
|
|---|
| 16 | //=> false
|
|---|
| 17 | ```
|
|---|
| 18 | */
|
|---|
| 19 | (stream: unknown): stream is stream.Stream;
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | @returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
|---|
| 23 |
|
|---|
| 24 | @example
|
|---|
| 25 | ```
|
|---|
| 26 | import * as fs from 'fs';
|
|---|
| 27 | import isStream = require('is-stream');
|
|---|
| 28 |
|
|---|
| 29 | isStream.writable(fs.createWriteStrem('unicorn.txt'));
|
|---|
| 30 | //=> true
|
|---|
| 31 | ```
|
|---|
| 32 | */
|
|---|
| 33 | writable(stream: unknown): stream is stream.Writable;
|
|---|
| 34 |
|
|---|
| 35 | /**
|
|---|
| 36 | @returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
|---|
| 37 |
|
|---|
| 38 | @example
|
|---|
| 39 | ```
|
|---|
| 40 | import * as fs from 'fs';
|
|---|
| 41 | import isStream = require('is-stream');
|
|---|
| 42 |
|
|---|
| 43 | isStream.readable(fs.createReadStream('unicorn.png'));
|
|---|
| 44 | //=> true
|
|---|
| 45 | ```
|
|---|
| 46 | */
|
|---|
| 47 | readable(stream: unknown): stream is stream.Readable;
|
|---|
| 48 |
|
|---|
| 49 | /**
|
|---|
| 50 | @returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
|---|
| 51 |
|
|---|
| 52 | @example
|
|---|
| 53 | ```
|
|---|
| 54 | import {Duplex} from 'stream';
|
|---|
| 55 | import isStream = require('is-stream');
|
|---|
| 56 |
|
|---|
| 57 | isStream.duplex(new Duplex());
|
|---|
| 58 | //=> true
|
|---|
| 59 | ```
|
|---|
| 60 | */
|
|---|
| 61 | duplex(stream: unknown): stream is stream.Duplex;
|
|---|
| 62 |
|
|---|
| 63 | /**
|
|---|
| 64 | @returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
|---|
| 65 |
|
|---|
| 66 | @example
|
|---|
| 67 | ```
|
|---|
| 68 | import * as fs from 'fs';
|
|---|
| 69 | import Stringify = require('streaming-json-stringify');
|
|---|
| 70 | import isStream = require('is-stream');
|
|---|
| 71 |
|
|---|
| 72 | isStream.transform(Stringify());
|
|---|
| 73 | //=> true
|
|---|
| 74 | ```
|
|---|
| 75 | */
|
|---|
| 76 | transform(input: unknown): input is stream.Transform;
|
|---|
| 77 | };
|
|---|
| 78 |
|
|---|
| 79 | export = isStream;
|
|---|