Skip to content

WriteStream

Source: src/Cloudflare/Pipelines/WriteStream.ts

Binding service that turns a Pipelines Stream (or a LegacyPipeline) into a typed WriteStreamClient you can call from a Worker’s runtime Effect.

The Cloudflare Worker pipelines binding is producer-only — send ingests a batch of JSON records into the stream.

const events = yield* Cloudflare.Pipelines.WriteStream(Stream);
return {
fetch: Effect.gen(function* () {
yield* events.send([{ event: "click", at: new Date().toISOString() }]);
return HttpServerResponse.empty({ status: 202 });
}),
};

Provide WriteStreamBinding (native Worker binding) in the worker’s runtime layer to resolve the underlying stream at request time.

WriteStream is a single identifier that is simultaneously the binding’s Context tag, its type, and the callable — yield* Cloudflare.Pipelines.WriteStream(stream).