evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that reads cached assets by key and returns both payload and metadata for downstream consumers needing content-type and expiry awareness.
contentType and version. @testexpiresAt timestamp that is less than or equal to the provided current time, the result includes stale: true while still returning the stored data, integrity, and metadata. @testnull without throwing. @testexport type CacheReadResult = {
data: Buffer;
metadata: Record<string, any>;
integrity: string;
size: number;
stale: boolean;
};
/**
* Reads a cached asset by key, returning both content and metadata.
* @param cacheDir - Cache directory location.
* @param key - Cache key to read.
* @param now - Optional function returning current epoch millis; defaults to Date.now.
* @returns CacheReadResult when present, or null when missing.
*/
export async function readCachedAsset(
cacheDir: string,
key: string,
now?: () => number
): Promise<CacheReadResult | null>;Content-addressable cache used for keyed retrieval of cached content and metadata.