(chibi io)

(utf8->string vec . o)

(string->utf8 str . o)

(write-line str [out])

(write-string str [out [start [end]]])

Writes the characters from start to end of string str to output port out, where start defaults to 0 and end defaults to (string-length str).

(read-line [in [n]])

Read a line from the input port in, defaulting to (current-input-port), and return the result as a string not including the newline. Reads at most n characters, defaulting to 8192.

(read-line [in])

(read-string n [in])

Reads n characters from input-port in, defaulting to (current-input-port), and returns the result as a string. Returns "" if n is zero. May return a string with fewer than n characters if the end of file is reached, or the eof-object if no characters are available.

(read-string n . o)

(read-string! str n [in])

Reads n characters from port in, which defaults to (current-input-port), and writes them into the string str starting at index 0. Returns the number of characters read. An error is signalled if the length of str is smaller than n.

(read-string! str n . o)

(send-file fd-port-or-filename [out])

Sends the entire contents of a file or input port to an output port.

(port-fold kons knil [read])

The fundamental port iterator.

(port-fold-right kons knil [read])

(port-map fn . o)

(port->list read in)

(port->sexp-list in)

(port->string-list in)

(port->string in)

(port->bytevector in)

(file->string path)

(file->bytevector path)

(make-custom-input-port read [seek])

read is a procedure of three arguments: (lambda (str start end) ...) which should fill str from start to end with bytes, returning the actual number of bytes filled.

(make-custom-output-port write [seek])

write is a procedure of three arguments: (lambda (str start end) ...) which should write the bytes of str from start to end, returning the actual number of bytes written.

(make-custom-binary-input-port read [seek])

Similar to make-custom-input-port but returns a binary port, and read receives a bytevector to fill instead of a string.

(make-custom-binary-output-port write [seek])

Similar to make-custom-output-port but returns a binary port, and write receives data from a bytevector instead of a string.

(make-null-output-port)

A simple /dev/null port which accepts and does nothing with any data written to it.

(make-broadcast-port . ports)

A port to broadcast everything written to it to multiple output ports.

(make-filtered-output-port filter out)

An output port which runs all output (in arbitrary string chunks) through the filter procedure.

(make-concatenated-port . ports)

An input port which acts as all of the ports concatenated together in order.

(make-null-input-port)

A /dev/null input port which always returns eof-object.

(make-generated-input-port generator)

A utility to represent a port generated in chunks by the thunk generator, which should return a single string representing the next input to buffer, or #f when there is no more input.

(make-filtered-input-port filter in)

An input port which runs all input (in arbitrary string chunks) through the filter procedure.

int: seek/set

int: seek/cur

int: seek/end

(file-position sexp)

(set-file-position! sexp off_t int)

(is-a-socket? fileno)

(open-input-bytevector sexp)

(open-output-bytevector)

(get-output-bytevector sexp)

(string-count-chars sexp sexp sexp sexp)

(write-u8 sexp sexp)

(read-u8 sexp)

(peek-u8 sexp)