(buffer-channel channel) -> function
(buffer-channel/2 channel channel) -> function
buffer-channel takes an input channel as an argument, and returns a
function that may be called to read a fixed number of bytes from the
channel.
Example:
>> (import "lib/buffer-channel") :: [closure buffer-channel/2] >> (define chan (make-channel)) :: [channel 5652E0] >> (define read-chan (buffer-channel chan)) :: [closure read-channel-buffer] >> (send "alpha" chan) :: null >> (read-chan 1) :: "a" >> (read-chan 3) :: "lph" >> (read-chan 4)
This waits forever, because there is only one byte in the buffer.
buffer-channel/2 takes an input, and a forwarding channel as arguments,
and does the same thing, but, instead of ignoring non-string messages,
as buffer-channel does, it forwards them to the forwarding channel.