UNPKG

@helia/verified-fetch

Version:

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

32 lines 1.4 kB
import type { RequestFormatShorthand } from '../types.js'; import type { CID } from 'multiformats/cid'; interface GetETagArg { cid: CID; reqFormat?: RequestFormatShorthand; rangeStart?: number; rangeEnd?: number; /** * Weak Etag is used when we can't guarantee byte-for-byte-determinism (generated, or mutable content). * Some examples: * - IPNS requests * - CAR streamed with blocks in non-deterministic order * - TAR streamed with files in non-deterministic order */ weak?: boolean; /** * A custom prefix to use for the content of the etag. This is needed for some cases (like dir-index-html) where we need to use a custom prefix for the etag. */ contentPrefix?: string; } /** * etag * you need to wrap cid with "" * we use strong Etags for immutable responses and weak one (prefixed with W/ ) for mutable/generated ones (ipns, car, tar, and generated HTML). * block and car responses should have different etag than deserialized one, so you can add some prefix like we do in existing gateway * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag * @see https://specs.ipfs.tech/http-gateways/path-gateway/#etag-response-header */ export declare function getETag({ cid, reqFormat, weak, rangeStart, rangeEnd, contentPrefix }: GetETagArg): string; export {}; //# sourceMappingURL=get-e-tag.d.ts.map