UNPKG

@helia/verified-fetch

Version:

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

39 lines 1.66 kB
import type { CID } from 'multiformats/cid'; interface CacheControlHeaderOptions { /** * This should be seconds as a number. * * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#response_directives */ ttl?: number; protocol: 'ipfs' | 'ipns'; response: Response; } /** * Implementations may place an upper bound on any TTL received, as noted in Section 8 of [rfc2181]. * If TTL value is unknown, implementations should not send a Cache-Control * No matter if TTL value is known or not, implementations should always send a Last-Modified header with the timestamp of the record resolution. * * @see https://specs.ipfs.tech/http-gateways/path-gateway/#cache-control-response-header */ export declare function setCacheControlHeader({ ttl, protocol, response }: CacheControlHeaderOptions): void; /** * This function returns the value of the `Content-Range` header for a given range. * If you know the total size of the body, pass it as `byteSize` * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range */ export declare function getContentRangeHeader({ byteStart, byteEnd, byteSize }: { byteStart: number | undefined; byteEnd: number | undefined; byteSize: number | undefined; }): string; /** * Sets the `X-Ipfs-Roots` header on the response if it exists. * * @see https://specs.ipfs.tech/http-gateways/path-gateway/#x-ipfs-roots-response-header */ export declare function setIpfsRoots(response: Response, ipfsRoots?: CID[]): void; export declare function getIpfsRoots(ipfsRoots: CID[]): string; export {}; //# sourceMappingURL=response-headers.d.ts.map