File_writer
is a thin wrapper around Writer
with a couple of extra features:
1. 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.
2. 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.
include sig ... end
val sexp_of_t : t ‑> Sexplib.Sexp.t
val create : ?append:bool ‑> string ‑> t Async_extra__.Import.Deferred.t
create file
opens file
, creating it if it doesn't exist.
val write_substring : t ‑> Core.Substring.t ‑> unit
val write_bigsubstring : t ‑> Core.Bigsubstring.t ‑> unit
val write_bigstring : t ‑> ?pos:int ‑> ?len:int ‑> Core.Bigstring.t ‑> unit
val schedule_bigstring : t ‑> Core.Bigstring.t ‑> unit
val write_iobuf : t ‑> ?pos:int ‑> ?len:int ‑> ([> Core.read ], _) Core.Iobuf.t ‑> unit
val write_bin_prot : t ‑> 'a Bin_prot.Type_class.writer ‑> 'a ‑> unit
val write_sexp : ?hum:bool ‑> t ‑> Async_extra__.Import.Sexp.t ‑> unit
val monitor : t ‑> Async_extra__.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 Async_extra__.Import.Deferred.t
val close : t ‑> unit Async_extra__.Import.Deferred.t