Open this example in the interactive library
Source code
import {
Readable,
Writable,
Transform,
PassThrough,
isReadable,
isWritable,
} from "node:stream";
import { text, json, arrayBuffer } from "node:stream/consumers";
import { pipeline, finished } from "node:stream/promises";
console.log(
(() => {
const stream = new PassThrough();
return [isReadable(stream), isWritable(stream)];
})(),
);
Sample output
[ true, true ]
