MCPcopy
hub / github.com/remix-run/remix / getCachedTransformedFile

Function getCachedTransformedFile

packages/assets/src/lib/files/compiler.ts:439–464  ·  view source on GitHub ↗
(
    cacheKey: string,
    identityPath: string,
    fingerprint: string | null,
  )

Source from the content-addressed store, hash-verified

437 }
438
439 async function getCachedTransformedFile(
440 cacheKey: string,
441 identityPath: string,
442 fingerprint: string | null,
443 ): Promise<EmittedFile | null> {
444 if (!resolvedOptions.cache) return null
445
446 let file = await resolvedOptions.cache.get(cacheKey)
447 if (!file) return null
448
449 let body = new Uint8Array(await file.arrayBuffer())
450 let metadata =
451 transformedAssetMetadataByCacheKey.get(cacheKey) ??
452 (await createEmittedFileMetadata(body, {
453 extension: path.extname(file.name).toLowerCase(),
454 filePath: identityPath,
455 fingerprint,
456 }))
457
458 rememberTransformedAssetMetadata(cacheKey, identityPath, metadata)
459
460 return {
461 body,
462 ...metadata,
463 }
464 }
465
466 async function setCachedTransformedFile(
467 cacheKey: string,

Callers 1

Calls 4

getMethod · 0.65
arrayBufferMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…