Stream Data Type v2
A Stream represents opaque content such as a file body, document content, or request payload. Flowgear passes a Stream between compatible Node Methods without first converting the complete value to a String or Array.
Map a Stream
Author a Stream as one value:
Content:
Type: stream
Expression: "{downloadFile.Content}"
A Stream is opaque. It cannot define child Properties, and mapping cannot select fields or bytes inside it. Pass it to a compatible consumer or use an appropriate parser or conversion Node first.
Consumption and replay
Streams are consumed as downstream work reads them. If no downstream branch consumes a produced Stream, the runtime drains it (reads and discards the result) when the owning execution scope closes so that the producer can finish and release resources.
When several consumers reference the same Stream, the compiled Workflow can add replay. Replay may use temporary spill files, which Flowgear cleans up when the Workflow releases them. Although replay supports valid multi-consumer designs, it adds I/O and processing overhead. You can avoid this overhead by ensuring that a stream is only read once (i.e. that it is only connected to one downstream Property).
The same direct Stream source cannot be mapped to more than one top-level Workflow Return. Return it once and let the caller consume that output.
Lifetime and logging
The Runtime owns deferred resources for the relevant Workflow or ForEach scope. Do not treat a Stream as a durable asset after that scope completes. Store the content explicitly when another Workflow or later process must retrieve it.
Workflow Logging can wrap a Stream to capture progress and a limited preview without changing the value supplied to its consumer. Large-value storage and preview limits determine what remains available after the run.
Choose Stream, String, or Array
Use:
- Stream for deferred binary or text content that a compatible Node will consume.
- String when the complete text value must be available as text.
- Array when the value is an enumerable collection of records or scalar items.
- Object after a document has been parsed into named fields.