isNodeStream
Checks if a value is a Node.js stream (has a .pipe() method).
Uses duck-typing: any object with a pipe function qualifies, covering
Readable, Writable, Duplex, Transform, and custom stream-compatible
objects without importing from node:stream.
Available since v2.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is object — true if value is a Node.js stream
Examples
Section titled “Examples”Detect a Node.js stream
Section titled “Detect a Node.js stream”Returns true for any object with a .pipe() method (Readable, Writable, Transform, etc.).
Guard before piping an unknown value
Section titled “Guard before piping an unknown value”Use isNodeStream to safely pipe only known streams.
