Skip to content

Streams Domain

The Streams domain provides stream-oriented utilities for processing inbound and outbound data without loading everything into memory.

aivi
use aivi.net.streams

Types

aivi
type Stream A
type StreamError = { message: Text }

Functions

FunctionExplanation
fromSocket connection
Connection -> Stream (List Int)
Creates a stream of byte chunks from the connection.
toSocket connection stream
Connection -> Stream (List Int) -> Effect StreamError Unit
Writes byte chunks from stream to the connection.
chunks size stream
Int -> Stream (List Int) -> Stream (List Int)
Rechunks a byte stream into fixed-size blocks of size.