---
url: 'https://adk.nht.io/api/@nhtio/adk/common/functions/fromFetch.md'
---

# Function: fromFetch()

```ts
function fromFetch(url: string | URL, init?: RequestInit): MediaReader;
```

Defined in: [lib/helpers/media\_readers.ts:44](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/helpers/media_readers.ts#L44)

Constructs a [@nhtio/adk!MediaReader](../interfaces/MediaReader.md) backed by a fetch call.

## Parameters

| Parameter | Type              | Description                               |
| --------- | ----------------- | ----------------------------------------- |
| `url`     | `string` | `URL` | The URL to fetch on each call.            |
| `init?`   | `RequestInit`     | Optional `fetch` init forwarded verbatim. |

## Returns

[`MediaReader`](../interfaces/MediaReader.md)

A [@nhtio/adk!MediaReader](../interfaces/MediaReader.md) that re-issues `fetch(url, init)` on every call.

## Remarks

Each `stream()` call re-issues the fetch. Tool authors whose underlying source is rate-limited
or expensive must cache locally before constructing the reader — the framework cannot make
that decision for them.

`byteLength()` returns `undefined` because most remote sources do not promise it without an
extra HEAD request; consumers that need a byte size should resolve it out-of-band.
