# `Stevedore.MediaType`
[🔗](https://github.com/oshlabs/stevedore/blob/v0.2.0/lib/stevedore/media_type.ex#L1)

The OCI and Docker media-type strings, with classifiers.

A media type tags what a descriptor points at — a manifest, an index (manifest list), a
config, or a layer — and, for layers, how the tar is compressed. Stevedore handles both the
OCI and the legacy Docker schema-2 vocabularies, since real registries serve a mix.

Spec: [OCI image-spec media-types](https://github.com/opencontainers/image-spec/blob/main/media-types.md)
and the [Docker image manifest v2 schema 2](https://distribution.github.io/distribution/spec/manifest-v2-2/).

# `all_manifest_types`

```elixir
@spec all_manifest_types() :: [String.t()]
```

All manifest+index media types, for use in an `Accept` header.

# `config?`

```elixir
@spec config?(String.t()) :: boolean()
```

Whether `media_type` names an image config.

# `docker_config`

```elixir
@spec docker_config() :: String.t()
```

The Docker image config media type.

# `docker_layer_gzip`

```elixir
@spec docker_layer_gzip() :: String.t()
```

The Docker gzip-compressed layer media type.

# `docker_manifest`

```elixir
@spec docker_manifest() :: String.t()
```

The Docker schema-2 manifest media type.

# `gzip?`

```elixir
@spec gzip?(String.t()) :: boolean()
```

Whether a layer `media_type` is gzip-compressed (`+gzip` / `.tar.gzip`).

## Examples

    iex> Stevedore.MediaType.gzip?("application/vnd.oci.image.layer.v1.tar+gzip")
    true

    iex> Stevedore.MediaType.gzip?("application/vnd.oci.image.layer.v1.tar")
    false

# `index?`

```elixir
@spec index?(String.t()) :: boolean()
```

Whether `media_type` names a multi-arch index / manifest list.

## Examples

    iex> Stevedore.MediaType.index?("application/vnd.docker.distribution.manifest.list.v2+json")
    true

# `layer?`

```elixir
@spec layer?(String.t()) :: boolean()
```

Whether `media_type` names a layer.

## Examples

    iex> Stevedore.MediaType.layer?("application/vnd.docker.image.rootfs.diff.tar.gzip")
    true

# `manifest?`

```elixir
@spec manifest?(String.t()) :: boolean()
```

Whether `media_type` names a single-image manifest (OCI or Docker).

## Examples

    iex> Stevedore.MediaType.manifest?("application/vnd.oci.image.manifest.v1+json")
    true

    iex> Stevedore.MediaType.manifest?("application/vnd.oci.image.index.v1+json")
    false

# `oci_config`

```elixir
@spec oci_config() :: String.t()
```

The OCI image config media type.

# `oci_index`

```elixir
@spec oci_index() :: String.t()
```

The OCI image index (manifest list) media type.

# `oci_layer`

```elixir
@spec oci_layer() :: String.t()
```

The OCI uncompressed layer media type (a plain tar).

# `oci_layer_gzip`

```elixir
@spec oci_layer_gzip() :: String.t()
```

The OCI gzip-compressed layer media type.

# `oci_layer_zstd`

```elixir
@spec oci_layer_zstd() :: String.t()
```

The OCI zstd-compressed layer media type.

# `oci_manifest`

```elixir
@spec oci_manifest() :: String.t()
```

The OCI image manifest media type.

# `zstd?`

```elixir
@spec zstd?(String.t()) :: boolean()
```

Whether a layer `media_type` is zstd-compressed (`+zstd`).

## Examples

    iex> Stevedore.MediaType.zstd?("application/vnd.oci.image.layer.v1.tar+zstd")
    true

---

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