Enter the URL you'd like to take a screenshot of here
async
(params, auths) => {
}
// See the browserless docs for more info:
// https://docs.browserless.io/
const puppeteer = require('puppeteer-core')
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://chrome.browserless.io?token=${auths.browserless.api_key}`
})
const page = await browser.newPage()
const { url } = params
await page.goto(url)
const screenshot = await page.screenshot()
// export the base64-encoded screenshot for use in future steps,
// along with the image type and filename
this.screenshot = Buffer.from(screenshot, 'binary').toString('base64')
this.type = "png"
this.filename = `${url.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '_')}-${+new Date()}.${this.type}`
await browser.close()
MIME type of the content to upload, for S3 metadata
Filename with extension
A string of base64-encoded data, or a variable reference to that string
async
(params, auths) => {
}
const AWS = require("aws-sdk")
const { bucket, ContentType, filename, data } = params
const { accessKeyId, secretAccessKey } = auths.aws
const s3 = new AWS.S3({
accessKeyId,
secretAccessKey,
})
const uploadParams = {
Bucket: bucket,
Key: filename,
Body: Buffer.from(data, 'base64'),
ContentType,
}
this.S3Response = await s3.upload(uploadParams).promise()
console.log(`Uploaded file to S3!`)