Write json to file as text Elixir -


i have done following there better way this?:

file.write("../hello", poison.encode!(some_stuff)) 

you missing third argument, mode options. work:

file.write("../hello", poison.encode!(some_stuff), [:binary]) 

other missing argument, what have line of code easy understand. use of encode! exception raised if encoding fails. if want ensure file written without checking return value file.write/3 should use file.write!/3. using file.write!/3 fits better erlang's "let crash" philosophy (http://learnyousomeerlang.com/errors-and-exceptions). though depends on context of line...


Comments

Popular posts from this blog

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -