Model to stream
Description
Pure function that serialises a model to an output stream. Supports JSON, YAML, and XML formats. Use to send a model as an HTTP request body without buffering the whole payload into memory.
When to use
Use Model to stream when a model needs to become the body of an HTTP request. The HTTP request node takes an output stream for its body so that large payloads are written to the socket on demand rather than buffered in memory — Model to stream bridges a model value into that stream without an intermediate string.
If you only need the serialised text (for logging, comparison, or storage), use Model to
string instead. Reach for Model to stream specifically when the destination is a
streaming consumer such as http-request.body.
See the Models tutorial for a full worked example.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| Model | model | — | The model value to serialise. Wire from a Make node, a Parse to model node, or any output that produces a model. |
| Format | Data format | JSON | The serialisation format: JSON, YAML, or XML. |
Output pins
| Pin | Type | Notes |
|---|---|---|
| Stream | Output stream | An output stream that, when consumed, writes the serialised model bytes. Wire directly into the body input of HTTP request. |
Example
POST a JSON model to an external API. Build the payload with a Make node, wire its Value
output into the Model input of Model to stream (Format set to JSON), then feed the
Stream output directly into the Body input of HTTP request (Method set to POST). The
model is serialised straight to the request socket, avoiding any full-payload buffering.