Module bytes

Types

BytePipe* = Pipe[byte]
  Source Edit
ByteInput* = Input[byte]
  Source Edit
ByteOutput* = Output[byte]
  Source Edit
LengthByteInput* = LengthInput[byte]
  Source Edit

Procs

proc read*(self: Input[byte]; count: int): Future[string]
Reads exactly count bytes from stream. Raises error if stream is closed before it manages to read them.   Source Edit
proc readSome*(self: Input[byte]; maxCount: int): Future[string]
Reads at least one byte, but not more than maxCount. Raises error if stream is closed anything is read.   Source Edit
proc readItem*[T](self: Input[byte]; `type`: typedesc[T]; endian: Endianness): Future[T]
Read value of type T with specified endanness. (T should be scalar type like int32)   Source Edit
proc readChunkPrefixed*(self: Input[byte]; sizeEndian = bigEndian): Future[string] {.
async
.}
Read chunk of text prefixed by 4 byte length   Source Edit
proc readChunksPrefixed*(self: Input[byte]; sizeEndian = bigEndian): Input[string]
Iterate over byte input reading chunks prefixed by length.   Source Edit
proc write*(self: Output[byte]; data: string): Future[void]
Alias for Output[byte].sendAll   Source Edit
proc writeItem*[T](self: Output[byte]; item: T; endian: Endianness): Future[void]
Write value of type T with specified endanness. (T should be scalar type like int32)   Source Edit
proc writeChunkPrefixed*(self: Output[byte]; item: string; sizeEndian = bigEndian): Future[
    void] {.
async
.}
Write chunk prefixed by 4-byte length.   Source Edit
proc writeChunksPrefixed*(self: Output[byte]): Output[string]
Write strings over byte output prefixed by length.   Source Edit
proc readUntil*(self: Input[byte]; chars: set[char]; limit = high(int)): Future[string] {.
async
.}
Read from stream until one of chars is read or limit bytes are read.   Source Edit
proc readUntilEof*(self: Input[byte]; limit = high(int)): Future[string]
Read data until EOF or limit bytes are read.   Source Edit
proc readLine*(self: Input[byte]; limit = high(int)): Future[string]
Read line until LF (0x10) character or limit bytes are read.   Source Edit
proc lines*(self: Input[byte]; limit = high(int)): Input[string] {.
asynciterator
.}
Iterate over lines of an input stream.   Source Edit