Skip to content

Instance Method

write(bytes:)

Writes bytes to the buffer, flushing to the underlying writer if capacity is reached.
mutating func write(bytes: some Collection<UInt8> & Sendable) async throws

Parameters

bytes

The bytes to write to the buffer.

Discussion

This method accumulates the provided bytes in the internal buffer. If the buffer’s capacity is reached, the entire buffer is forwarded to the underlying writer and then cleared.