Last active
September 11, 2019 16:02
-
-
Save linxinemily/a0ff366e2d8a8ada6f3d0c5afc2b6a5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const browser: Browser = await puppeteer.launch() | |
const page: Page = await browser.newPage() | |
await page.setViewport({ width: 1440, height: 900 }) | |
await page.goto(url) | |
const screenshot = await page.screenshot({ encoding: 'base64'}) | |
await browser.close() | |
const src = `data:image/jpeg;base64,${screenshot}` | |
res(new responseData(src, { name: 'screenshot' })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment