package git

  1. Overview
  2. Docs

Channel abstraction.

type ic

Type for input channels.

type oc

Type for output channels.

type ctx

Connection context.

val with_connection : ?ctx:ctx -> Uri.t -> ?init:string -> ((ic * oc) -> 'a Lwt.t) -> 'a Lwt.t

Connect to a remote server, get the corresponding input and output channels and apply a function on them. Close the channel once the function returns. The init corresponds to an optional first message sent on the connection to set-it up.

val read_all : ic -> string list Lwt.t

Read all the channel contents (until the channel is closed by the other side).

val read_exactly : ic -> int -> string Lwt.t

Read a given number of bytes.

val write : oc -> string -> unit Lwt.t

Write a string on a channel.

val flush : oc -> unit Lwt.t

Flush the channel.