Read Files

Create a function to read files without using the Flow library.

Read files

Reading files from the file system is easy with Elixir. However, there are a few things to consider when we consume file data and transform it to common Elixir data structures. This section introduces Flow by comparing it to the Enum and Stream modules and see how we can reduce system memory usage and increase performance when reading files.

We add a function that returns all currently operational airports from the airports.csv file. To do this, we have to read the file and remove all closed airports from the list of results. We convert the results to an Elixir Map, and only keep the data attributes in which we are interested.

Get hands-on with 1400+ tech skills courses.