View Source DeepSinker (deep_sinker v0.1.1)
Documentation for DeepSinker
.
Link to this section Summary
Link to this section Types
@type filepath() :: String.t()
@type item_path() :: String.t()
@type item_type() :: :file | :directory | :ignore
@type opt() :: [order: :asc | :desc, handler: handler()]
@type order() :: :asc | :desc
@type result() :: {:ok, filepath()} | :done
@type t() :: %DeepSinker{ found_items: [item_path()], handler: handler() | nil, order: order(), root_items: [item_path()] }
State of traversing.
Link to this section Functions
Create initial state.
examples
Examples
iex> DeepSinker.new(["/path/to/dir1", "/path/to/dir2"])
...> |> is_struct(DeepSinker)
true
iex> DeepSinker.new(["/path/to/dir1", "/path/to/dir2"],
...> order: :desc,
...> handler: fn item_path ->
...> cond do
...> item_path == ".git" -> :ignore
...> String.contains?(item_path, ".") -> :file
...> true -> :directory
...> end
...> end
...> )
...> |> is_struct(DeepSinker)
true
Pop file and update state.
Stream filepaths.