UNPKG

@helia/verified-fetch

Version:

A fetch-like API for obtaining verified & trustless IPFS content on the web

47 lines 1.71 kB
import type { CreateVerifiedFetchOptions, Resource, VerifiedFetchInit as VerifiedFetchOptions } from './index.js'; import type { Helia } from '@helia/interface'; export declare class VerifiedFetch { private readonly helia; private readonly ipnsResolver; private readonly dnsLink; private readonly log; private readonly contentTypeParser; private readonly withServerTiming; private readonly plugins; private readonly urlResolver; constructor(helia: Helia, init?: CreateVerifiedFetchOptions); /** * Load a resource from the IPFS network and ensure the retrieved data is the * data that was expected to be loaded. * * Like [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) * but verified. */ fetch(resource: Resource, opts?: VerifiedFetchOptions): Promise<Response>; /** * Returns a prioritized list of acceptable content types for the response * based on the CID and a passed `Accept` header */ private getAcceptHeader; /** * The last place a Response touches in verified-fetch before being returned * to the user. This is where we add the Server-Timing header to the response * if it has been collected. It should be used for any final processing of the * response before it is returned to the user. */ private handleFinalResponse; private runPluginPipeline; /** * Start the Helia instance */ start(): Promise<void>; /** * Shut down the Helia instance */ stop(): Promise<void>; } export interface RequestedMimeType { mediaType: string; options: Record<string, string>; } //# sourceMappingURL=verified-fetch.d.ts.map