Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Structure

MemoryMultipartWriter

A synchronous MultipartWriter that buffers the output in memory.
struct MemoryMultipartWriter<OutboundBody> where OutboundBody : RangeReplaceableCollection, OutboundBody : Sendable, OutboundBody.Element == UInt8

Overview

This writer accumulates all multipart data in an internal buffer, making it suitable for scenarios where you need to generate the complete multipart message before sending. The buffer can be retrieved using getResult() after writing all parts.

var writer = MemoryMultipartWriter<[UInt8]>(boundary: "boundary123")
try await writer.writePart(MultipartPart(
    headerFields: [.contentType: "text/plain"],
    body: Array("Hello, world!".utf8)
))
try await writer.finish()
let result = writer.getResult()

Topics

Initializers

Instance Properties

  • let boundary: String
    The boundary separating the parts of the message, without its leading hyphens.

Instance Methods

Type Aliases

Relationships

Conforms To