Signature
Type Parameters
type
default:"any"
The type of data that will be written to the stream.
Parameters
WorkflowWritableStreamOptions
Configuration options for the writable stream.
Returns
WritableStream<W>
A WritableStream that can be written to from within step functions.The stream follows the Web Streams API standard.
Usage
Basic Stream Writing
Write data to the stream from a step:Stream JSON Objects
Write structured data:Multiple Namespaced Streams
Use different streams for different purposes:Stream Progress Updates
Send real-time progress to external consumers:Pipe Transform Stream
Pipe data through a transform:Reading from Outside the Workflow
Consume the stream data from outside:Error Handling
Handle stream errors:Notes
- Can be called from both workflow functions and step functions
- The stream is automatically serialized and sent to the workflow server
- Data written to the stream can be read outside the workflow using
getRun().readable() - Multiple streams can be created using different namespaces
- The stream follows the Web Streams API standard
- Written data is automatically serialized using the workflow serialization format
- The stream is associated with the current workflow run ID
Related
- getStepMetadata - Get current step metadata
- getWorkflowMetadata - Get workflow run metadata