( job: BinaryDownloadJob, version: string, sha256: string | null, zippedSha256: string | null, )
| 420 | } |
| 421 | |
| 422 | async function saveFileToCache( |
| 423 | job: BinaryDownloadJob, |
| 424 | version: string, |
| 425 | sha256: string | null, |
| 426 | zippedSha256: string | null, |
| 427 | ): Promise<void> { |
| 428 | // always fail silent, as the cache is optional |
| 429 | const cacheDir = await getCacheDir(channel, version, job.binaryTarget) |
| 430 | if (!cacheDir) { |
| 431 | return |
| 432 | } |
| 433 | |
| 434 | const cachedTargetPath = path.join(cacheDir, job.binaryName) |
| 435 | const cachedSha256Path = path.join(cacheDir, job.binaryName + '.sha256') |
| 436 | const cachedSha256ZippedPath = path.join(cacheDir, job.binaryName + '.gz.sha256') |
| 437 | |
| 438 | try { |
| 439 | await overwriteFile(job.targetFilePath, cachedTargetPath) |
| 440 | if (sha256 != null) { |
| 441 | await fs.promises.writeFile(cachedSha256Path, sha256) |
| 442 | } |
| 443 | if (zippedSha256 != null) { |
| 444 | await fs.promises.writeFile(cachedSha256ZippedPath, zippedSha256) |
| 445 | } |
| 446 | } catch (e) { |
| 447 | debug(e) |
| 448 | // let this fail silently - the CI system may have reached the file size limit |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | export async function maybeCopyToTmp(file: string): Promise<string> { |
| 453 | // in this case, we are in a "pkg" context with a virtual fs |
no test coverage detected