/**
 * Data-access helpers for the {@link Record} class.
 *
 * `RecordData` is the object returned by `Record.data`. It wraps a lazily
 * evaluated `stream()` function with convenience accessors that mirror the
 * Fetch `Response` API (`blob()`, `bytes()`, `json()`, `text()`).
 *
 * Data is **cached after first read** so that subsequent calls to any accessor
 * return the same data without re-fetching. Concurrent calls are safe — only
 * one fetch is performed and all callers share the result.
 *
 * Extracted from `record.ts` so the convenience-method boilerplate lives in
 * its own module while the stream-resolution logic (which is tightly coupled
 * to `Record` internals) stays inside the `Record` class.
 *
 * @module
 */
/**
 * A thenable data accessor returned by {@link Record.data}.
 *
 * Provides convenience methods for consuming the record's data in various
 * formats, plus `then`/`catch` so the object can be awaited directly to
 * obtain the underlying `ReadableStream`.
 *
 * Data is cached after the first read so that repeated calls (e.g.,
 * `data.json()` followed by `data.text()`) do not trigger redundant
 * network requests.
 *
 * @beta
 */
export type RecordData = {
    /** Consume the data as a `Blob`. */
    blob: () => Promise<Blob>;
    /** Consume the data as raw bytes. */
    bytes: () => Promise<Uint8Array>;
    /** Parse the data as JSON. */
    json: <T = unknown>() => Promise<T>;
    /** Consume the data as a UTF-8 string. */
    text: () => Promise<string>;
    /** Obtain the underlying Web `ReadableStream`. */
    stream: () => Promise<ReadableStream>;
    /** Proxy for `stream().then(...)` so the object is directly awaitable. */
    then: (onFulfilled?: (value: ReadableStream) => ReadableStream | PromiseLike<ReadableStream>, onRejected?: (reason: any) => PromiseLike<never>) => Promise<ReadableStream>;
    /** Proxy for `stream().catch(...)`. */
    catch: (onRejected?: (reason: any) => PromiseLike<never>) => Promise<ReadableStream>;
};
/**
 * Create a {@link RecordData} wrapper around a `stream` provider function.
 *
 * The first call to any accessor (`blob`, `bytes`, `json`, `text`, `stream`)
 * consumes the underlying stream and caches the raw bytes (up to
 * {@link DATA_CACHE_LIMIT}). Subsequent calls reconstruct a fresh stream
 * from the cache, preventing the common footgun of stale data after stream
 * consumption.
 *
 * Concurrent calls are safe: if multiple accessors are called simultaneously,
 * only one stream fetch is performed and all callers share the result.
 *
 * @param streamFn   - A function that returns a `Promise<ReadableStream>` for the record data.
 * @param dataFormat - The MIME type used when constructing Blobs.
 * @returns A {@link RecordData} object with convenience accessors.
 *
 * @beta
 */
export declare function createRecordData(streamFn: () => Promise<ReadableStream>, dataFormat: string | undefined): RecordData;
//# sourceMappingURL=record-data.d.ts.map