# `BAM.Index.BAI`
[🔗](https://github.com/baoulo/bam-elixir/blob/v0.1.0/lib/bam/index/bai.ex#L1)

BAI index codec.

A BAI file is uncompressed little-endian data. It is not BGZF. The magic
is `BAI\1`. Bin 37450, when present, stores the reference's offset range
and its mapped and unmapped counts. Those values are not seek ranges.
Linear-index slots that were never filled are the unsigned 64-bit sentinel
`2^64 - 1`.

# `decode`

```elixir
@spec decode(binary(), BAM.Limits.t()) ::
  {:ok, BAM.Index.t()} | {:error, BAM.Error.t()}
```

Decodes a BAI binary.

# `encode`

```elixir
@spec encode(BAM.Index.t()) :: {:ok, binary()} | {:error, BAM.Error.t()}
```

Encodes an index as an uncompressed BAI file.

---

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