Thanks, this makes the code much more readable, not much examples for this module, if someone needs one for this particular case:
defmodule FileInfo do
require Record
Record.defrecord :file_info, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
end
and then instead my previous line I have a keyword list that can be accessed with
iex(3)> import FileInfo
FileInfo
iex(4)> info
{:file_info, 2333891, :regular, :read, {{2020, 12, 29}, {19, 18, 12}},
{{2020, 12, 29}, {19, 27, 58}}, {{2020, 12, 29}, {19, 27, 58}}, 33188, 1,
66310, 0, 302070, 33, 19}
iex(5)> file_info(info)
[
size: 2333891,
type: :regular,
access: :read,
atime: {{2020, 12, 29}, {19, 18, 12}},
mtime: {{2020, 12, 29}, {19, 27, 58}},
ctime: {{2020, 12, 29}, {19, 27, 58}},
mode: 33188,
links: 1,
major_device: 66310,
minor_device: 0,
inode: 302070,
uid: 33,
gid: 19
]
iex(6)> file_info(info, :size)
2333891