StreamWriter
A streaming uploader.
struct StreamWriter
StreamWriter
abstracts
A streaming uploader.
struct StreamWriter
StreamWriter
abstracts
import AsyncHTTPClient
This package provides simple HTTP Client library built on top of SwiftNIO.
struct Body
A request body.
class HTTPClient
HTTPClient class provides API for request execution.
static func byteBuffer(_ buffer: ByteBuffer) -> Body
Create and stream body using ByteBuffer
.
@preconcurrency static func bytes<Bytes>(_ bytes: Bytes) -> Body where Bytes : RandomAccessCollection, Bytes : Sendable, Bytes.Element == UInt8
Create and stream body using a collection of bytes.
static func data(_ data: Data) -> HTTPClient.Body
Create and stream body using Data
.
static func stream(contentLength: Int64? = nil, _ stream: @escaping (StreamWriter) -> EventLoopFuture<Void>) -> Body
Create and stream body using StreamWriter
.
@preconcurrency static func stream(length: Int? = nil, _ stream: @escaping (StreamWriter) -> EventLoopFuture<Void>) -> Body
Create and stream body using StreamWriter
.
static func string(_ string: String) -> Body
Create and stream body using String
.
var contentLength: Int64?
Body size. If nil,Transfer-Encoding
will automatically be set to chunked
. Otherwise a Content-Length
header is set with the given contentLength
.
var stream: (StreamWriter) -> EventLoopFuture<Void>
Body chunk provider.
var length: Int? { get set }
Body size. If nil,Transfer-Encoding
will automatically be set to chunked
. Otherwise a Content-Length
header is set with the given length
.
init(closure: @escaping (IOData) -> EventLoopFuture<Void>)
Create new StreamWriter
func write(_ data: IOData) -> EventLoopFuture<Void>
Write data to server.