import { ResourceBytesRequest, ResourceBytesItem, ResourceInfo } from '@napplet/core'; /** * Napplet NAP resource sdk entrypoint. * * @module */ /** * Inspect resource schemes and coarse runtime policy limits. * * @returns Promise resolving to advisory resource info. */ declare function resourceInfo(): Promise; /** Alias for {@link resourceInfo} on the SDK subpath. */ declare const info: typeof resourceInfo; /** * Fetch bytes for a URL through the shell's resource pipeline. * * @param url URL identifying the resource (any registered scheme: * `data:`, `https:`, `blossom:`, `htree:`, `nostr:`, ...) * @returns Promise resolving to the fetched bytes as a Blob * * @example * ```ts * import { resourceBytes } from '@napplet/nap/resource'; * * const blob = await resourceBytes('blossom:sha256:abc123...', { * servers: ['https://cdn.hzrd149.com'], * }); * const url = URL.createObjectURL(blob); * ``` */ declare function resourceBytes(url: string, opts?: { servers?: string[]; signal?: AbortSignal; }): Promise; /** Alias for {@link resourceBytes} on the SDK subpath. */ declare const bytes: typeof resourceBytes; /** * Fetch bytes for many URLs through the shell's resource pipeline. * * @param requests Non-empty resource request list with optional per-resource Blossom servers. * @param opts Optional `{ signal }` for AbortController cancellation. * @returns Promise resolving to ordered per-URL result items. * * @example * ```ts * import { resourceBytesMany } from '@napplet/nap/resource'; * * const items = await resourceBytesMany([ * { url: 'https://example.com/avatar.png' }, * { url: 'blossom:sha256:...', servers: ['https://cdn.hzrd149.com'] }, * { url: 'htree://example-root/path' }, * ]); * ``` */ declare function resourceBytesMany(requests: ResourceBytesRequest[], opts?: { signal?: AbortSignal; }): Promise; /** Alias for {@link resourceBytesMany} on the SDK subpath. */ declare const bytesMany: typeof resourceBytesMany; /** * Fetch bytes and return a managed object URL handle. * Call `revoke()` to release the underlying Blob URL. * * @param url URL identifying the resource * @returns Synchronous handle `{ url, revoke }`. The `url` field is populated * when the underlying fetch resolves; await any returned `ready` * promise (shim-specific extension) before reading. * * @example * ```ts * import { resourceBytesAsObjectURL } from '@napplet/nap/resource'; * * const handle = resourceBytesAsObjectURL('blossom:abc123...'); * imgEl.src = handle.url; * imgEl.onload = () => handle.revoke(); * ``` */ declare function resourceBytesAsObjectURL(url: string): { url: string; revoke: () => void; }; /** Alias for {@link resourceBytesAsObjectURL} on the SDK subpath. */ declare const bytesAsObjectURL: typeof resourceBytesAsObjectURL; export { bytes, bytesAsObjectURL, bytesMany, info, resourceBytes, resourceBytesAsObjectURL, resourceBytesMany, resourceInfo };