How to use freeze-dry - 3 common examples

To help you get started, we’ve selected a few freeze-dry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inkandswitch / pushpin / src / freeze-dry-preload / index.ts View on Github external
async function capturePage() {
  // TODO(jeff): Provide a custom `fetchResource(url: string): Response`
  // option to prevent cors errors.
  const html = await freezeDry(document)
  const { url } = await files.write(
    Stream.fromBuffer(Buffer.from(html, 'utf8')),
    document.contentType
  )
  ipcRenderer.sendToHost('freeze-dry', url)
}
github arso-project / hyper-content-db / examples / importer / webpage / index.js View on Github external
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
github inkandswitch / capstone / src / apps / clipper / content.js View on Github external
import freezeDry from "freeze-dry"

var capstoneExtensionId = "gcdcngjcmfebohcjojfbfkmpenlfjcfc"

freezeDry(document, { addMetadata: true }).then(html => {
  const msg = { contentType: "HTML", src: window.location.href, content: html }

  chrome.runtime.sendMessage(capstoneExtensionId, msg, response => {
    console.log("Capstone got the HTML.")
  })
})

freeze-dry

Snapshots a web page to get it as a static, self-contained HTML document.

Unlicense
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Popular freeze-dry functions