Skip to content

Initializer

init(asyncStream:count:byteBufferAllocator:)

Creates a chunked HTTP Response steam using AsyncBodyStreamWriter.
init(asyncStream: @escaping @Sendable (any AsyncBodyStreamWriter) async throws -> (), count: Int, byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator())

Parameters

asyncStream

The closure that will generate the results. MUST call .end or .error when terminating the stream

count

The amount of bytes that will be written. The asyncStream MUST produce exactly count bytes.

byteBufferAllocator

The allocator that is preferred when writing data to SwiftNIO