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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -