let strings_of_channel ?(buffer_size=65536) inp = let buf = String.create buffer_size in from (fun _ -> match In_channel.input inp ~buf ~pos:0 ~len:buffer_size with | 0 -> None | len -> Some (String.sub buf ~pos:0 ~len) )