Added support for type commands
This commit is contained in:
parent
abb422c7f1
commit
4c853ae503
3 changed files with 39 additions and 14 deletions
15
html-to-png.js
Normal file
15
html-to-png.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Puppeteer } from "puppeteer";
|
||||
|
||||
export default async function (html) {
|
||||
|
||||
const browser = await Puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.setContent(html);
|
||||
const file = await page.screenshot({ type: "png" });
|
||||
|
||||
await page.close();
|
||||
await browser.close();
|
||||
|
||||
return file;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue