# `ASDF.Sink`
[🔗](https://github.com/baoulo/asdf-elixir/blob/v0.1.0/lib/asdf/sink.ex#L1)

Where `ASDF.write/3` puts bytes.

A path is a file. `:binary` means the caller wants the bytes back from
`ASDF.write/3` as `{:ok, binary}`.

# `put`

```elixir
@spec put(Path.t() | :binary, iodata()) ::
  :ok | {:ok, binary()} | {:error, ASDF.Error.t()}
```

Writes `iodata` to `sink`.

`sink` is `:binary` or a filesystem path. `iodata` is a binary or an
iodata list. `:binary` returns `{:ok, bytes}`. A path returns `:ok`, or
`{:error, %ASDF.Error{reason: :io}}` when the write fails. Does not raise.

## Examples

    iex> ASDF.Sink.put(:binary, ["ab", "c"])
    {:ok, "abc"}

    iex> path = Path.join([System.tmp_dir!(), "asdf-missing-sink", "nope.asdf"])
    ...> {:error, error} = ASDF.Sink.put(path, "hi")
    ...> error.reason
    :io

---

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