This commit is contained in:
seb
2026-10-08 04:51:28 +02:00
parent 7829addbdd
commit be02e531c5
3 changed files with 61 additions and 10 deletions

View File

@@ -270,7 +270,9 @@ export async function capturePage(debugPort, url, file, { width, height, settleM
{ format: 'png', captureBeyondViewport: true, fromSurface: true },
30000,
);
fs.writeFileSync(file, Buffer.from(data, 'base64'));
const buf = Buffer.from(data, 'base64');
if (file) fs.writeFileSync(file, buf);
return buf;
} finally {
session.close();
await fetch(`http://127.0.0.1:${debugPort}/json/close/${target.id}`).catch(() => {});