# Blob Library (Blob)

Library for working with binary blobs (Vec\<u8> or Uint8Array), linked to the 'blob' type. Useful when working with web APIs, raw binary data, and in exchange scenarios between formats (see "blobify" in the Std library for more details).

## Blob.at(bytes: blob, index: int) -> int

Byte at a specific index within this blob.

```rust
const bytes: blob = "hello";
assert_eq(bytes[1], 101); // or '.at(1)' or 'Blob.at(bytes, 1)'
```

## Blob.base64(bytes: blob) -> str

Transform this blob into a string using Base64 encoding.

```rust
const bytes: blob = "hello";
assert_eq(bytes.base64(), "aGVsbG8=");
```

## Blob.from\_base64(val: str) -> blob

Transform a string into a blob, using Base64 encoding.

```rust
const bytes: blob = Blob.from_base64("aGVsbG8=");
assert_eq(bytes as str, "hello");
```

## Blob.from\_url\_base64(val: str) -> blob

Transform a string into a blob, using URL-safe Base64 encoding.

```rust
const bytes: blob = Blob.from_url_base64("aGVsbG8=");
assert_eq(bytes as str, "hello");
```

## Blob.from\_utf8(val: str) -> blob

Transform a string into a blob, using standard UTF-8 encoding (default for normal casts too).

```rust
const bytes: blob = "hello";
assert_eq(bytes, Blob.from_utf8("hello"));
```

## Blob.len(bytes: blob) -> int

Size of this binary blob (integer number of bytes).

```rust
const bytes: blob = "hello";
assert_eq(bytes.len(), 5);
```

## Blob.size(bytes: blob) -> bytes

Size of this binary blob (in units of bytes).

```rust
const bytes: blob = "hello";
assert_eq(bytes.size(), 5bytes);
```

## Blob.url\_base64(bytes: blob) -> str

Transform this blob into a string using URL-safe Base64 encoding.

```rust
const bytes: blob = "hello";
assert_eq(bytes.url_base64(), "aGVsbG8=");
```

## Blob.utf8(bytes: blob) -> str

Transform this blob into a string using UTF-8 (default conversion for casts also).

```rust
const bytes: blob = "hello";
assert_eq(bytes.utf8(), "hello");
assert_eq(bytes as str, "hello");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stof.dev/libraries/type-libraries/blob-library-blob.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
