Module Write.By_row

type row = string list
val output_lines : ?⁠quote:char -> ?⁠sep:char -> ?⁠line_breaks:[ `Windows | `Unix ] -> Core_kernel.Out_channel.t -> row list -> unit

Prints a valid csv file to a given channel. The line_breaks arg can be used to override the default line ending of "\r\n" (DOS/Windows line endings). Example ~line_breaks:`Unix to get *nix line endings

val line_to_string : ?⁠quote:char -> ?⁠sep:char -> row -> string

Convert one CSV line to a string.

val with_writer : ?⁠sep:char -> ?⁠line_breaks:[ `Unix | `Windows ] -> Async.Writer.t -> f:(string list Async.Pipe.Writer.t -> 'a Async.Deferred.t) -> 'a Async.Deferred.t

Make a pipe writer for a list of strings from a writer. The string list will be formatted as CSV.

Once with_writer's return Deferred becomes determined, it is guaranteed that the whole CSV has hit the OS buffer.

The writer will NOT be closed when the pipe closes.

val with_file : ?⁠sep:char -> ?⁠line_breaks:[ `Unix | `Windows ] -> string -> f:(string list Async.Pipe.Writer.t -> 'a Async.Deferred.t) -> 'a Async.Deferred.t

Make a pipe writer for a list of strings from a filename. The string list will be formatted as CSV.