Synced from site

This commit is contained in:
2025-03-12 18:53:16 +01:00
parent 3e13363c6c
commit 6541d83fba
301 changed files with 31858 additions and 30212 deletions
+17 -17
View File
@@ -1,17 +1,17 @@
// @ts-check
import fs from "node:fs";
import { fsCachePath } from "../../utils/runtimeChecks.js";
export async function getCachedBuffer(hash, image) {
const cacheFilePath = fsCachePath + hash;
if (fs.existsSync(cacheFilePath)) {
return fs.promises.readFile(cacheFilePath);
}
const buffer = await image.clone().toBuffer();
await fs.promises.writeFile(cacheFilePath, buffer);
return buffer;
}
// @ts-check
import fs from "node:fs";
import { fsCachePath } from "../../utils/runtimeChecks.js";
export async function getCachedBuffer(hash, image) {
const cacheFilePath = fsCachePath + hash;
if (fs.existsSync(cacheFilePath)) {
return fs.promises.readFile(cacheFilePath);
}
const buffer = await image.clone().toBuffer();
await fs.promises.writeFile(cacheFilePath, buffer);
return buffer;
}