Created
September 11, 2019 16:03
-
-
Save linxinemily/c7f5dd3fd2a06bee0d070263dbfc01c9 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, { waitUntil: ['networkidle2'], timeout: 0 }) | |
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