Mcompose
Bun

method

crypto.Hmac.compose

stream: WritableStream | WritableStream<any> | TransformStream<any, any> | (source: any) => void,
options?: Abortable
): Duplex;
import { Readable } from 'node:stream';

async function* splitToWords(source) {
  for await (const chunk of source) {
    const words = String(chunk).split(' ');

    for (const word of words) {
      yield word;
    }
  }
}

const wordsStream = Readable.from(['this is', 'compose as operator']).compose(splitToWords);
const words = await wordsStream.toArray();

console.log(words); // prints ['this', 'is', 'compose', 'as', 'operator']

See stream.compose for more information.

@returns

a stream composed with the stream stream.

Referenced types

interface WritableStream<W = any>

interface TransformStream<I = any, O = any>