Skip to content

Instantly share code, notes, and snippets.

open Core
open Async
(* Copy data from the reader to the writer, using the provided buffer
as scratch space *)
let rec copy_blocks buffer r w =
Reader.read r buffer
>>= function
| `Eof -> return ()
| `Ok bytes_read ->