Skip to content

Stream, Seekable, BufferedStream, StreamReader/StreamWriter

License

Notifications You must be signed in to change notification settings

swiftstack/stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stream

The package does a few things:

  1. Abstracts reading&writing from&to file|socket|anything (buffer + size)
  2. Implements BufferedStream with various reallocate options
  3. Implements a lot of sugar like StreamReader, StreamWriter

Package.swift

.package(url: "https://github.com/swiftstack/stream.git", .branch("dev"))

Usage

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
}

See also

NetworkStream
File+Stream

About

Stream, Seekable, BufferedStream, StreamReader/StreamWriter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published