Add some file functions in Elixir by adding some NIFs using Rustler.
- inotify
- file listing stream
Examples (inotify)
{:ok, ref} = Flier.Inotify.start_watcher("/tmp", [:create])
receive do
{:inotify_event, file, mask} -> IO.puts("File '#{file}' triggered by #{inspect mask}")
end
:stopped = Flier.Inotify.stop_watcher(ref)"/tmp"
|> Flier.Inotify.stream([:close_write])
|> Enum.each(fn {file, mask} -> IO.puts("File '#{file}' triggered by #{inspect mask}") end)Examples (entries)
"/tmp"
|> Flier.Entries.stream()
|> Enum.each(fn entry -> IO.puts("Entry '#{entry.name}' is a '#{entry.type}'") end)Installation
If available in Hex, the package can be
installed by adding flier to your list of dependencies in mix.exs:
def deps do
[
{:flier, "~> 0.3.0"}
]
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/flier.