Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
Joshua Castle
2024-03-24 01:00:56 -07:00
parent 46a868f1f8
commit 3299879ad1
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -29,8 +29,9 @@ class ImageGenerator {
const absolutePath = path_1.default.join(this.outDir, imageName);
const relativePath = path_1.default.join('/', this.args.dir, absolutePath.slice(this.outDir.length));
const svg = await this.satori(element, options);
const pngBuffer = new resvg_js_1.Resvg(svg).render().asPng();
fs.writeFileSync(absolutePath, pngBuffer);
const resvg = new resvg_js_1.Resvg(svg);
const pngOutput = resvg.render();
await fsp.writeFile(absolutePath, pngOutput.asPng());
const url = new URL(this.args.websiteUrl);
url.pathname = relativePath;
this.cache[hash] = {
+3 -2
View File
@@ -54,8 +54,9 @@ export class ImageGenerator {
)
const svg = await this.satori(element, options)
const pngBuffer = new Resvg(svg).render().asPng();
fs.writeFileSync(absolutePath, pngBuffer);
const resvg = new Resvg(svg);
const pngOutput = resvg.render();
await fsp.writeFile(absolutePath, pngOutput.asPng());
const url = new URL(this.args.websiteUrl)
url.pathname = relativePath