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
Post a Comment