INTEGRITY Cloudflare Docs

WritableStream

Background

A WritableStream is the writable property of a TransformStream. On the Workers platform, WritableStream cannot be directly created using the WritableStream constructor.

A typical way to write to a WritableStream is to pipe a ReadableStream to it.

readableStream
  .pipeTo(writableStream)
  .then(() => console.log('All data successfully written!'))
  .catch(e => console.error('Something went wrong!', e));

To write to a WritableStream directly, you must use its writer.

const writer = writableStream.getWriter();
writer.write(data);

Refer to the WritableStreamDefaultWriter documentation for further detail.

Properties

Methods