Function: fromFetch()
ts
function fromFetch(url: string | URL, init?: RequestInit): MediaReader;Constructs a @nhtio/adk!MediaReader 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
A @nhtio/adk!MediaReader 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.