# `PlaywrightEx.Artifact`
[🔗](https://github.com/ftes/playwright_ex/blob/v0.12.0/lib/playwright_ex/artifact.ex#L1)

Interact with a Playwright `Artifact`.

Artifacts are Playwright-owned files produced by operations such as tracing or
downloads. Local Playwright connections expose a finished artifact path
directly, while remote connections require streaming the artifact bytes through
the protocol.

# `opt`

```elixir
@type opt() :: {:connection, GenServer.name()} | {:timeout, timeout()}
```

# `delete`

```elixir
@spec delete(PlaywrightEx.guid(), [opt() | PlaywrightEx.unknown_opt()]) ::
  {:ok, any()} | {:error, any()}
```

Deletes an artifact from Playwright.

# `save_as`

```elixir
@spec save_as(PlaywrightEx.guid(), Path.t(), [opt() | PlaywrightEx.unknown_opt()]) ::
  :ok | {:error, any()}
```

Saves an artifact to `path`.

Copies locally or streams over WebSocket, preserving the source artifact.
Creates parent directories and replaces the destination only when saving
succeeds. Temporary files and streams are cleaned up on failure.

The required `:timeout` covers the whole transfer. `0` times out immediately;
`:infinity` disables the timeout. Cleanup may outlast the transfer timeout.
Expected cleanup errors preserve the transfer result; unexpected errors propagate.

---

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