Streaming Pipe Input in libuv

We’ll start with our reliable favorite, the standard input pipe. libuv makes it much simpler to work with pipes than to work with files. True disk files don’t natively support the same poll-based I/O techniques that pipes and sockets do, but we’ll work around that a little later.

The PipeHandle provided by libuv, and its associated methods, aren’t especially novel at this point:

 type​ ​PipeHandle​ = Ptr[​Byte​]

Despite adding a few new methods, we’ll largely interact with pipe input like we did with sockets, via the read_start() function and its callbacks.

Before we start writing code, however, we should work out a clean, adaptable design for our data structure. Since Scala already ...

Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.