Managing Files in Elixir's Livebook

243
clicks
Managing Files in Elixir's Livebook

Source: peterullrich.com

Type: Post

In this post, Peter Ullrich presents a concise guide for working with files in Livebook, a tool used for interactive and collaborative coding within the Elixir ecosystem. He describes how to upload files using the `Kino.Input.file/1` function and notes that this process does not create a traditional file but rather a file reference. Ullrich explains that to get the actual data, one must call `Kino.Input.read/1`. He also touches on the limitations of single-file uploads and expresses interest in finding a multi-file upload solution. Further, he discusses how to process file contents in memory, using the `CSV` library to handle CSV files by streaming and decoding it into a format that can be easily manipulated. Lastly, he explains how to download files by encoding individual maps of processed data back into a single string and using `Kino.Download.new/2` to create a downloadable file. Throughout the post, Ullrich emphasizes utility while hinting at his other resources such as his book and video course.

© HashMerge 2024