Copy stream
Description
Pure function bridging an input stream into an output stream without buffering. When the downstream consumer (e.g. http-request) writes the body, the bytes are pulled from the input stream and piped straight through. Use this to forward an FTP-downloaded file or an HTTP response body into another HTTP request without materialising it as a string first.
When to use
Use Copy stream when you already have an input stream — for instance an FTP-downloaded file from Open FTP file, or the body of an HTTP response read via Receive HTTP — and you want to feed it into a node that accepts an output stream, such as the body of an outbound HTTP request. Going via Stream to string + String to stream works for small text payloads, but buffers the entire body into memory; Copy stream forwards the bytes directly and works for arbitrary binary content.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| Input | Input stream | — | The input stream to forward. The stream is consumed on demand by the downstream consumer and closed afterwards. |
Output pins
| Pin | Type | Notes |
|---|---|---|
| Stream | Output stream | An output stream that, when consumed, pulls bytes straight from the input stream. |
Example
Re-upload a file fetched over FTP to a webhook without buffering it in memory. Wire the File
output of Open FTP file into the Input of Copy stream. Feed the Stream output into the Body
input of HTTP request (Method set to POST). The bytes flow from the FTP-backed temporary
file straight through to the request socket.