(binary io) - Binary I/O utilities

Library (binary data)

Binary I/O utility. In real world you sometimes want to treat binary port like textual port (e.g. get-line for binary port). This library exports those convenient procedures

Binary I/O

in must be binary input port.

Reads a bytevector from in until it hits the eol data. _eol_can be multiple length such as #vu8(#x0d #x0a). Default value is #vu8(#x0a)If keyword argument transcoder is given, then returning value will be converted to string.

Re-exported procedure from (sagittarius) for convenience. See Sagittarius extensions.

out must be binary output port. endian must be a value returned from endianness macro.

Write v to out as unsigned/signed 16/32/64 bit integer or 32/64 bit floating number.

Re-exported procedure from (sagittarius) for convenience. See Sagittarius extensions.

in must be binary input port. endian must be a value returned from endianness macro.

Read a number from in as unsigned/signed 16/32/64 bit integer or 32/64 bit floating number.

Chunk buffered port

Default binary input port requires bytevector however if users want to handle bigger data then it would not be suitable. Chunk buffered port is a buffered port which buffer is chunks of bytevector so that it doesn't allocate huge memory.

Creates chunk buffered port.

->chunks must be a procedure which takes one argument, chunk-size. And must return a list of bytevectors which size is chunk-size except the last element.

The keyword argument chunk-size is specified then it must be a positive integer. By default +default-chunk-size+ is used.

Default chunk size of chunk buffered port.

Creates chunk buffered port from given iport.

iport must be a binary input port.

The keyword argument threshold is specified, it must be a positive integer, then the procedure only reads the number of threshold bytes from iport.