You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.d.ts
+14-5Lines changed: 14 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,15 @@ import {
6
6
TransformasTransformStream,
7
7
}from'node:stream';
8
8
9
+
exporttypeOptions={
10
+
/**
11
+
When this option is `true`, the method returns `false` if the stream has already been closed.
12
+
13
+
@default: `false` with `isStream()`, `true` with the other methods
14
+
*/
15
+
checkOpen?: boolean;
16
+
};
17
+
9
18
/**
10
19
@returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
11
20
@@ -21,7 +30,7 @@ isStream({});
21
30
//=> false
22
31
```
23
32
*/
24
-
exportfunctionisStream(stream: unknown): stream is Stream;
33
+
exportfunctionisStream(stream: unknown,options?: Options): stream is Stream;
25
34
26
35
/**
27
36
@returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable), an [`http.OutgoingMessage`](https://nodejs.org/api/http.html#class-httpoutgoingmessage), an [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) or an [`http.ClientRequest`](https://nodejs.org/api/http.html#class-httpserverresponse).
exportfunctionisWritableStream(stream: unknown): stream is WritableStream;
47
+
exportfunctionisWritableStream(stream: unknown,options?: Options): stream is WritableStream;
39
48
40
49
/**
41
50
@returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) or an [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage).
Copy file name to clipboardExpand all lines: readme.md
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,26 +23,35 @@ isStream({});
23
23
24
24
## API
25
25
26
-
### isStream(stream)
26
+
### isStream(stream, options?)
27
27
28
28
Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
29
29
30
-
####isWritableStream(stream)
30
+
### isWritableStream(stream, options?)
31
31
32
32
Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable), an [`http.OutgoingMessage`](https://nodejs.org/api/http.html#class-httpoutgoingmessage), an [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) or an [`http.ClientRequest`](https://nodejs.org/api/http.html#class-httpserverresponse).
33
33
34
-
####isReadableStream(stream)
34
+
### isReadableStream(stream, options?)
35
35
36
36
Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) or an [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage).
37
37
38
-
####isDuplexStream(stream)
38
+
### isDuplexStream(stream, options?)
39
39
40
40
Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
41
41
42
-
####isTransformStream(stream)
42
+
### isTransformStream(stream, options?)
43
43
44
44
Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
45
45
46
+
### Options
47
+
48
+
#### checkOpen
49
+
50
+
Type: `boolean`\
51
+
Default: `false` with [`isStream()`](#isstreamstream-options), `true` with the other methods
52
+
53
+
When this option is `true`, the method returns `false` if the stream has already been closed.
54
+
46
55
## Related
47
56
48
57
-[is-file-stream](https://github.com/jamestalmage/is-file-stream) - Detect if a stream is a file stream
0 commit comments