Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Unix.closedir dh;
r
+let buffer_of_file file_path =
+ file_blocks_fold 1024 (fun b s -> Buffer.add_string b s; b) (Buffer.create 1024) file_path
+
+let bigbuffer_of_file file_path =
+ file_blocks_fold 1024 (fun b s -> Bigbuffer.append_string b s; b) (Bigbuffer.make ()) file_path
+
(** Read whole file from specified fd *)
let read_whole_file size_hint block_size fd =
let filebuf = Buffer.create size_hint in
(** Alias for function [file_lines_iter]. *)
val readfile_line : (string -> 'a) -> string -> unit
+
+(** [buffer_of_file file] returns a Buffer.t containing the contents of [file] *)
+val buffer_of_file : string -> Buffer.t
+
+(** [bigbuffer_of_file file] returns a Bigbuffer.t containing the contents of [file] *)
+val bigbuffer_of_file : string -> Bigbuffer.t
+
val read_whole_file : int -> int -> Unix.file_descr -> string
val read_whole_file_to_string : string -> string
val atomic_write_to_file : string -> Unix.file_perm -> (Unix.file_descr -> 'a) -> 'a