Hello, we are trying to convert a html string to svg and then from svg to png with this satori, satori-html and resvg
we followed this blog: https://anasrar.github.io/blog/generate-image-from-html-using-satori-and-resvg/
But after adding
import satori from "satori";
import { html } from "satori-html";
import { Body, Controller, Post } from "@nestjs/common";
@Controller()
export class AppController {
@Post("test")
@Public()
async test(@Body() body: any) {
const markup = html(`<div style="color: black;">hello, world</div>`);
const svg = await satori(markup, {
width: 600,
height: 400,
fonts: []
});
}
}
it seems to break our api completely as it is stuck in:
[3:55:40 PM] File change detected. Starting incremental compilation...
[3:55:41 PM] Found 0 errors. Watching for file changes.
on removing the html(...) part the api starts again.
Anas Rin
TL;DR Generate image from HTML using github.com/vercel/satori (to convert HTML to SVG) and github.com/yisibl/resvg-js (to convert SVG to PNG) on Node.js and...
Common errors - "File change detected" loops endlessly