smallex v0.2.3 Fl

File library.

Link to this section Summary

Link to this section Functions

Link to this function write!(content, path, modes \\ [])

Write file after pipe

Examples

iex> "sample text" |> Fl.write!( "test/sample.txt" )
"sample text"
iex> File.read!( "test/sample.txt" )
"sample text"
iex> File.rm!( "test/sample.txt" )
:ok
Link to this function write_map_list!(map_list, path, option \\ :quote, modes \\ [])

Write file from map list after pipe

Examples

iex> [ %{ "key" => "k1", "value" => "v1" }, %{ "key" => "k2", "value" => "v2" }, %{ "key" => "k3", "value" => "v3" } ] |> Fl.write_map_list!( "test/sample.csv", :no_quote )
[ %{ "key" => "k1", "value" => "v1" }, %{ "key" => "k2", "value" => "v2" }, %{ "key" => "k3", "value" => "v3" } ] 
iex> File.read!( "test/sample.csv" )
"key, value
k1, v1
k2, v2
k3, v3
"
iex> File.rm!( "test/sample.csv" )
:ok

iex> [] |> Fl.write_map_list!( "test/sample2.csv", :no_quote )
[] 
iex> File.read!( "test/sample2.csv" )
""
iex> File.rm!( "test/sample2.csv" )
:ok