# `HTTP.Blob`
[🔗](https://github.com/gsmlg-dev/http_fetch/blob/v0.16.7/apps/http_core/lib/http/blob.ex#L1)

Represents a blob of binary data, similar to JavaScript's Blob.

A Blob contains raw data along with metadata about its MIME type and size.
This module implements the Browser Fetch API Blob interface for Elixir.

## Examples

    # Create a blob
    blob = HTTP.Blob.new(<<1, 2, 3, 4>>, "application/octet-stream")

    # Access properties
    HTTP.Blob.size(blob)  # 4
    HTTP.Blob.type(blob)  # "application/octet-stream"

    # Convert to binary
    data = HTTP.Blob.to_binary(blob)

# `t`

```elixir
@type t() :: %HTTP.Blob{data: binary(), size: non_neg_integer(), type: String.t()}
```

# `new`

```elixir
@spec new(binary(), String.t()) :: t()
```

Creates a new Blob from binary data with a specified MIME type.

## Parameters
  - `data` - Binary data to store in the blob
  - `type` - MIME type string (default: "application/octet-stream")

## Examples

    iex> blob = HTTP.Blob.new(<<1, 2, 3>>, "image/png")
    iex> blob.type
    "image/png"
    iex> blob.size
    3

# `size`

```elixir
@spec size(t()) :: non_neg_integer()
```

Returns the Blob's size in bytes.

## Examples

    iex> blob = HTTP.Blob.new(<<1, 2, 3, 4, 5>>, "application/octet-stream")
    iex> HTTP.Blob.size(blob)
    5

# `to_binary`

```elixir
@spec to_binary(t()) :: binary()
```

Converts the Blob to a binary, extracting the raw data.

## Examples

    iex> blob = HTTP.Blob.new(<<1, 2, 3>>, "application/octet-stream")
    iex> HTTP.Blob.to_binary(blob)
    <<1, 2, 3>>

# `type`

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

Returns the Blob's MIME type.

## Examples

    iex> blob = HTTP.Blob.new(<<>>, "text/plain")
    iex> HTTP.Blob.type(blob)
    "text/plain"

---

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