Goal
Stream a large or binary payload from one function to another without putting the data itself in a JSON function payload. Use a normal function invocation when the payload is small JSON and can be handled as one request. Use a channel when the payload is large, binary, or naturally stream-shaped. Good fits for channels:- File uploads and downloads.
- Images, audio, video, PDFs, and datasets.
- Progress updates during long-running work.
- Producer and consumer pipelines where the data should move as a stream.
For the underlying model, see Channels architecture.
Steps
1. Create a channel
A channel has two local stream objects and two serializable refs:writer: local writable stream.reader: local readable stream.writerRef: serializable token for the writer end.readerRef: serializable token for the reader end.
- Node / TypeScript
- Python
- Rust
2. Write to the channel
Write the stream payload to the local writer and close it when you are done.- Node / TypeScript
- Python
- Rust
3. Pass the reader ref to another function
Pass thereaderRef / reader_ref as part of a normal function invocation. The receiving function
uses that ref to read from the channel.
- Node / TypeScript
- Python
- Rust
4. Read from the channel
Node and Python deserialize channel refs into live channel objects before your handler runs. Rust receives the ref in JSON and reconstructs the reader withChannelReader::new(...).
- Node / TypeScript
- Python
- Rust
Result
The caller passes only a small ref throughtrigger(). The stream payload travels over the channel,
and the receiving function reads it incrementally.