Skip to content
Discussion options

You must be logged in to vote

Thanks. Seems like with puppeteer we can skip the complex cdp-client.

import puppeteer from "puppeteer";
import fs from "fs/promises";

import {
  script as SINGLEFILE_SCRIPT,
  hookScript as SINGLEFILE_HOOK,
  zipScript as SINGLEFILE_ZIP
} from "single-file-cli/lib/single-file-bundle.js";

async function capture(url) {
  const browser = await puppeteer.launch({
    headless: true,
    args: [
      "--disable-web-security",
      "--allow-running-insecure-content",
      "--no-sandbox"
    ]
  });

  const page = await browser.newPage();

  await page.evaluateOnNewDocument(SINGLEFILE_HOOK);
  await page.evaluateOnNewDocument(`
    ${SINGLEFILE_SCRIPT}
    window.singlefile = singlefile;
…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by gildas-lormeau
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #180 on November 14, 2025 15:14.