Namespace: joker.io
v1.0Contents
Summary
Provides small helpers for copying, piping, reading, and closing Joker I/O objects.
Index
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
close
Function v1.0(close f)Closes f and returns nil.
f must implement close, such as an IOWriter, IOReader, or File. Throws Error
when f is not closable or when closing fails. -
copy
Function v1.0(copy dst src)Copies bytes from src to dst until src reaches EOF or an error occurs.
Returns the number of bytes copied. Throws Error for read or write failures.
src must be IOReader, e.g. as returned by joker.os/open.
dst must be IOWriter, e.g. as returned by joker.os/create.
Example:
(joker.io/copy out in) -
pipe
Function v1.0(pipe)Creates a synchronous in-memory pipe and returns [reader writer].
Writes block until the reader consumes data, so use the two ends from
cooperating computations when neither side should stall the other. Closing
either end unblocks operations on the other end according to pipe semantics. -
read
Function v1.3.6(read r n)Performs one read from IOReader r and returns up to n bytes as a string.
This is not a read-exactly operation: it may return fewer than n bytes even
before EOF, and returns "" when EOF is encountered before any bytes are read.
Throws Error for non-EOF read failures. n should be non-negative.