npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@browserless/capture

v10.11.6

Published

Record a Puppeteer page using tabCapture API

Readme

@browserless/capture: Record a Puppeteer page using tabCapture API.

Install

npm install @browserless/capture --save

Usage

const createBrowser = require('browserless')
const createCapture = require('@browserless/capture')

const withCaptureExtension = (launchOpts = {}) => {
  const ignoreDefaultArgs = launchOpts.ignoreDefaultArgs

  return {
    ...launchOpts,
    args: [
      ...(launchOpts.args || []),
      `--allowlisted-extension-id=${createCapture.extensionId}`,
      `--disable-extensions-except=${createCapture.extensionPath}`,
      `--load-extension=${createCapture.extensionPath}`
    ],
    ignoreDefaultArgs:
      ignoreDefaultArgs === true
        ? true
        : [
            ...new Set([
              ...(Array.isArray(ignoreDefaultArgs) ? ignoreDefaultArgs : []),
              '--disable-extensions'
            ])
          ]
  }
}

const browser = createBrowser(withCaptureExtension({ headless: 'new' }))

const browserless = await browser.createContext()
const puppeteerBrowser = await browserless.browser()
const page = await puppeteerBrowser.defaultBrowserContext().newPage()
const capture = createCapture({ goto: browserless.goto })

const video = await capture(page)('https://example.com', {
  duration: 5000,
  type: 'mp4',
  codec: 'avc1.4D401F',
  path: '/tmp/demo.mp4'
})

await page.close()
await browserless.destroyContext()
await browser.close()

browserless core does not inject capture extension flags automatically. @browserless/capture requires:

  • Loading the bundled extension using --allowlisted-extension-id, --disable-extensions-except, and --load-extension.
  • Ensuring Chromium default arg --disable-extensions is ignored.
  • Creating the captured page from defaultBrowserContext() (not an incognito context).

API shape is intentionally simple, similar to page.screenshot()/page.pdf():

const capture = createCapture({ goto })
await capture(page)(url, opts)

Returns a Buffer and writes to opts.path when provided.

Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | type | 'webm' \| 'mp4' | 'mp4' | Output type selector mapped to MediaRecorder mime type. | | codec | string | Depends on type | MediaRecorder codec override. Defaults: webm -> vp9, mp4 -> avc1.4D401F. | | path | string | undefined | Write the captured media to disk. | | duration | number | 3000 | Capture duration in milliseconds. | | audio | boolean \| object | false | Capture audio. When object, it is used as audio track constraints. | | video | boolean \| object | true | Capture video. When object, it is used as video track constraints. |

Exports

  • capture.extensionPath: Absolute path to the bundled extension.
  • capture.extensionId: Extension ID used by the package.
  • capture.types: Supported values for type. capture uses goto(...).device.viewport as the capture viewport source. When video is true or omitted, video constraints are inferred from that viewport to keep capture framing aligned with screenshot/pdf rendering. When video is an object, that object is used as the video constraints. When audio is an object, that object is used as the audio constraints. The inferred constraints also account for deviceScaleFactor, so output video pixels match screenshot pixel density. type is mapped internally to the MediaRecorder mime type, and codec is appended as ;codecs=.... Default codecs are vp9 for webm and avc1.4D401F for mp4. You can override codec per request using opts.codec. For example:
await capture(page)(url, { type: 'webm', codec: 'vp8' })
await capture(page)(url, { type: 'mp4', codec: 'avc1.640033' })

When type is 'mp4', the running Chromium build must support MP4 MediaRecorder output. For strict screenshot/poster parity in headless mode, launch Chrome with matching --screen-info.

License

@browserless/capture © Microlink, released under the MIT License.