Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Body.StreamSourceStream represents streaming HTTP bodies. This module provides utilities to create and consume streams, while enforcing the invariant that only one consume can read from a stream, and that a stream can only be consumed once.
of_pipe is a convenience function that creates a stream from a user provided Async_kernel.Pipe.Reader.t. The pipe will be closed whenever the streaming body is closed, or EOF is reached.
close allows for closing/tearing-down any resources that are used to produce the content for a stream. For servers, this function will be called if the underlying client socket connection is closed, or when the body is fully drained.
encoding informs whether the body needs to be chunk encoded or not. For servers this function is used to automatically populate the transfer-encoding or content-length headers.
iter t ~f consumes chunks of data one at a time. The stream can only be iterated on once.
drain should consume items one at a time from the stream and discard them. This function raises if its called after a consumer has started reading data from the stream.
closed is a deferred that should be resolved when the stream is closed/drained.