# `Scandir`

Incremental, non-recursive directory enumeration with raw binary names.

# `cursor`

```elixir
@opaque cursor()
```

# `kind`

```elixir
@type kind() :: :directory | :regular | :symlink | :unknown | :other
```

# `reason`

```elixir
@type reason() ::
  :badarg
  | :busy
  | :closed
  | :enoent
  | :enotdir
  | :eacces
  | :eperm
  | :emfile
  | :enfile
  | :enomem
  | :enametoolong
  | :eloop
  | :eintr
  | :eio
```

# `close`

```elixir
@spec close(cursor()) :: :ok | {:error, reason()}
```

Closes a cursor. Closing an already closed cursor succeeds.

# `max_batch`

```elixir
@spec max_batch() :: 128
```

The largest accepted visit budget for `next/2`.

# `next`

```elixir
@spec next(cursor(), pos_integer()) ::
  {:ok, [{binary(), kind()}], :more | :eof} | {:error, reason()}
```

Visits up to `max_visited` entries, including skipped `.` and `..`.

# `open`

```elixir
@spec open(binary()) :: {:ok, cursor()} | {:error, reason()}
```

Opens a directory by its non-empty, NUL-free OS path. Start `:scandir` first.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
