diff --git a/unix/tar_lwt_unix.ml b/unix/tar_lwt_unix.ml index 313c90d..d455c2b 100644 --- a/unix/tar_lwt_unix.ml +++ b/unix/tar_lwt_unix.ml @@ -40,14 +40,8 @@ module Io = struct end include Io -module HR = Tar.HeaderReader(Lwt)(Io) -module HW = Tar.HeaderWriter(Lwt)(Io) - -let get_next_header ~global ic = - HR.read ~global ic - >>= function - | Error `Eof -> Lwt.return None - | Ok hdrs -> Lwt.return (Some hdrs) +module HeaderReader = Tar.HeaderReader(Lwt)(Io) +module HeaderWriter = Tar.HeaderWriter(Lwt)(Io) (** Return the header needed for a particular file on disk *) let header_of_file ?level (file: string) : Tar.Header.t Lwt.t = diff --git a/unix/tar_lwt_unix.mli b/unix/tar_lwt_unix.mli index 0faf69e..f153391 100644 --- a/unix/tar_lwt_unix.mli +++ b/unix/tar_lwt_unix.mli @@ -24,12 +24,12 @@ val really_write: Lwt_unix.file_descr -> Cstruct.t -> unit Lwt.t (** [really_write fd buf] writes the full contents of [buf] to [fd] or fails with {!Stdlib.End_of_file}. *) -(** Returns the next header block or None if two consecutive - zero-filled blocks are discovered. Assumes stream is positioned at the - possible start of a header block. - @raise Stdlib.End_of_file if the stream unexpectedly fails. *) -val get_next_header : global:Tar.Header.Extended.t option -> Lwt_unix.file_descr -> - (Tar.Header.t * Tar.Header.Extended.t option) option Lwt.t +val skip : Lwt_unix.file_descr -> int -> unit Lwt.t +(** [skip fd n] reads [n] bytes from [fd] and discards them. If possible, you + should use [Lwt_unix.lseek fd n Lwt_unix.SEEK_CUR] instead. *) (** Return the header needed for a particular file on disk. *) val header_of_file : ?level:Tar.Header.compatibility -> string -> Tar.Header.t Lwt.t + +module HeaderReader : Tar.HEADERREADER with type in_channel = Lwt_unix.file_descr and type 'a io = 'a Lwt.t +module HeaderWriter : Tar.HEADERWRITER with type out_channel = Lwt_unix.file_descr and type 'a io = 'a Lwt.t diff --git a/unix/tar_unix.mli b/unix/tar_unix.mli index 2b991f2..32ddd81 100644 --- a/unix/tar_unix.mli +++ b/unix/tar_unix.mli @@ -25,6 +25,8 @@ val really_write: Unix.file_descr -> Cstruct.t -> unit or {!Stdlib.End_of_file}. *) val skip : Unix.file_descr -> int -> unit +(** [skip fd n] reads [n] bytes from [fd] and discards them. If possible, you + should use [Unix.lseek fd n Unix.SEEK_CUR] instead. *) (** Return the header needed for a particular file on disk. *) val header_of_file : ?level:Tar.Header.compatibility -> string -> Tar.Header.t