Octez_tar_helpersThis module allows to create a tar archive by adding files to it, one by one. It can be seen as a list of contiguous files (made of a header followed by a raw data) closed by a specific end of file flag.
val open_out : file:string -> o Lwt.topen_out ~file opens a tar archive as an output archive located at file.
val close_out : o -> unit Lwt.tclose_out tar closes an output tar archive.
val add_raw_and_finalize :
o ->
f:(Lwt_unix.file_descr -> 'a Lwt.t) ->
filename:string ->
'a Lwt.tadd_raw_and_finalize tar ~f ~filename exposes a file descriptor of the tar archive through f to be able to write arbitrary data in the tar. When f terminates, a valid tar header referenced by filename is written
val add_file_and_finalize :
o ->
file:string ->
filename:string ->
buffer_size:int ->
unit Lwt.tadd_file_and_finalize tar ~file ~filename ~buffer_size copies the file, and reference it through the given filename, into a tar. It handles all specific operations an returns a handler ready to be enriched.
val add_directory_and_finalize :
?archive_prefix:string ->
o ->
dir_path:string ->
buffer_size:int ->
unit Lwt.tinput utilities
val open_in : file:string -> i Lwt.topen_in ~file opens a tar archive as an input archive located at file.
val close_in : i -> unit Lwt.tclose_in tar closes an input tar archive.
get_file tar ~filename returns the first occurrence of the file name filename from tar.
val get_filename : file -> stringget_filename file returns the file name of a file contained in a tar.
val get_file_size : file -> int64get_file_size file returns the file size of a file contained in a tar.
val get_raw_input_fd : i -> Lwt_unix.file_descrget_raw_input_fd tar returns the file descriptor to read directly in the tar file. It is no recommended to use it.
val get_raw_file_ofs : file -> int64get_raw_file_ofs file returns the position offset, from the beginning of the tar archive, of the given file.
find_file tar ~filename returns the file corresponding to the given filename within the given tar.
find_files_with_common_path tar ~pattern returns, from the tar all the files matching the given pattern.
load_file tar file loads the file from the tar and returns it as bytes. Warning, this function loads the whole data in memory.
val load_from_filename : i -> filename:string -> string option Lwt.tload_from_filename tar ~filename loads the file with the name filename from the given tar and returns it as bytes. Warning, this function loads the whole data in memory