init(managedAsyncStream:byteBufferAllocator:)
Creates a managed chunked HTTP Response
steam using AsyncBodyStreamWriter
that automtically closes or fails based if the closure throws an error or returns.
init(managedAsyncStream: @escaping (AsyncBodyStreamWriter) async throws -> (), byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator())
Parameters
- asyncStream
The closure that will generate the results, which MUST NOT call
.end
or.error
when terminating the stream.- count
The amount of bytes that will be written
- byteBufferAllocator
The allocator that is preferred when writing data to SwiftNIO