UNPKG

@helia/verified-fetch

Version:

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

27 lines 1.27 kB
import type { PluginContext } from '../plugins/types.js'; import type { Logger } from '@libp2p/interface'; import type { Blockstore } from 'interface-blockstore'; import type { ExporterOptions, ReadableStorage, ObjectNode, UnixFSEntry } from 'ipfs-unixfs-exporter'; import type { CID } from 'multiformats/cid'; export interface PathWalkerOptions extends ExporterOptions { } export interface PathWalkerResponse { ipfsRoots: CID[]; terminalElement: UnixFSEntry; } export interface PathWalkerFn { (blockstore: ReadableStorage, path: string, options?: PathWalkerOptions): Promise<PathWalkerResponse>; } export declare function isObjectNode(node: UnixFSEntry): node is ObjectNode; /** * Attempts to walk the path in the blockstore, returning ipfsRoots needed to resolve the path, and the terminal element. * If the signal is aborted, the function will throw an AbortError * If a terminal element is not found, a notFoundResponse is returned * If another unknown error occurs, a badGatewayResponse is returned * */ export declare function handlePathWalking({ cid, path, resource, options, blockstore, log }: PluginContext & { blockstore: Blockstore; log: Logger; }): Promise<PathWalkerResponse | Response>; //# sourceMappingURL=walk-path.d.ts.map