# `IntelHex`
[🔗](https://github.com/fhunleth/intel_hex/blob/v0.2.1/lib/intel_hex.ex#L1)

Manipulate Intel HEX files

This is the main interface for loading, modifying and saving Intel HEX files.
In general, you'll want to use methods here for most operations.

Internally, data is stored as lists of `IntelHex.Block` structs. See that
module for transformations that aren't possible with the main functions.

# `t`

```elixir
@type t() :: %IntelHex{blocks: [IntelHex.Block.t()], path: String.t()}
```

Primary type for handling Intel Hex file data

# `crop`

```elixir
@spec crop(t(), non_neg_integer(), non_neg_integer()) :: t()
```

Only keep data within the specified address range

# `get`

```elixir
@spec get(t(), non_neg_integer(), non_neg_integer(), [{:fill, 0..255}]) :: binary()
```

Get the data at a specified address

Options:
* `:fill` - value to use when none exists (defaults to `0`)

# `load`

```elixir
@spec load(Path.t()) :: {:ok, t()} | {:error, term()}
```

Load an Intel Hex-formatted file into memory

# `load!`

```elixir
@spec load!(Path.t()) :: t()
```

Load an Intel Hex-formatted file into memory

Raises File.Error or IntelHex.DecodeError if an error occurs.

# `new`

```elixir
@spec new() :: %IntelHex{blocks: [], path: String.t()}
```

Create an empty hex file

Use `IntelHex.set/3` or other functions to populate it.

# `save`

```elixir
@spec save(t(), Path.t(), keyword()) :: :ok
```

Save data to an Intel Hex-formatted file

Options:
* `:block_size` - the max data bytes per record. (defaults to 16)

# `set`

```elixir
@spec set(t(), non_neg_integer(), binary()) :: t()
```

Set a set of bytes at the specified address

---

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