Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function freeze (job, next) {
const dom = job.getResource('dom')
let html = job.getResource('html')
if (!dom) return next()
try {
html = await freezeDry(dom.window.document, {
docUrl: job.url,
fetchResource,
blobToURL,
getCsp
})
} catch (err) {
job.error('Cannot freeze-dry', dom.window.location, err)
}
// job.addResource('html-clean', html)
let filepath = urlToHtmlFile(job.url, { prefix: 'freeze-dry' })
job.addFile(filepath, html)
job.addRecord('file', { path: filepath, mimetype: 'text/html', type: 'freeze-dry', dangerous: false })
job.baseFilePath = filepath