10LOC

#backpressure

Node.jsadvanced

Piping a Readable through a Transform stream with backpressure

import { createReadStream, createWriteStream } from "node:fs";
import { pipeline } from "node:stream/promises";
import { Transform } from "node:stream";

const upperCaseChunks = new Transform({

Use stream/promises pipeline() to move data through a Transform without ever buffering more than the stream can hold.