The package does a few things:
- Abstracts reading&writing from&to file|socket|anything (
buffer
+size
) - Implements BufferedStream
with various
reallocate
options - Implements a lot of sugar like StreamReader, StreamWriter
.package(url: "https://github.com/swiftstack/stream.git", .branch("dev"))
let socket = client.accept()
let network = NetworkStream(socket: socket)
let stream = BufferedStream(baseStream: network)
let bytes = try stream.read(count: 10)
let result = try stream.read(count: 10) { rawBufferPointer in
return rawBufferPointer.count
}