File_writer is a thin wrapper around Writer with a couple of extra features:
  • It keeps track of all the file writers that have been created so that it can iterate over them to find out how many bytes in total they have to write.
  • It keeps track of whether the underlying writer has failed, and if so silently ignores future operations. This can prevent pointlessly filling up a writer's buffer with data that will never go anywhere.
type t
val create : ?append:bool -> string -> t Import.Deferred.t
create file opens file, creating it if it doesn't exist.
val write : t -> string -> unit
write t s writes s to the file.
val write_substring : t -> Core.Std.Substring.t -> unit
val write_bigsubstring : t -> Core.Std.Bigsubstring.t -> unit
val schedule_bigstring : t -> Core.Std.Bigstring.t -> unit
val write_bin_prot : t -> 'a Core.Std.Bin_prot.Type_class.writer -> 'a -> unit
val write_sexp : ?hum:bool -> t -> Core.Std.Sexp.t -> unit
val monitor : t -> Import.Monitor.t
val bytes_to_write : unit -> int
bytes_to_write () returns the sum over all async_file_writers of how many bytes they need to write.
val flushed : t -> unit Import.Deferred.t
val close : t -> unit Import.Deferred.t
val sexp_of_t : t -> Sexplib.Sexp.t