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

smooth-screenshot

v1.1.4

Published

Capture any DOM element to PNG, JPEG, WebP, SVG or PDF without ever freezing the UI. Cancellable, progress-reporting, handles huge content via tiling. Zero dependencies.

Readme

smooth-screenshot

npm version bundle size zero dependencies types license

Live demo & docs → luccas-carvalho.github.io/smooth-screenshot

Capture any DOM element to PNG, JPEG, WebP, SVG, or PDF — without ever freezing the UI.

Most DOM-to-image libraries do all their work in one synchronous burst: on a large element the page locks up, animations stutter, and your loading spinner freezes mid-spin. smooth-screenshot slices the work across frames with an internal cooperative scheduler, so the main thread stays responsive the whole time. Your skeletons and progress animations keep running while the capture happens.

  • Never blocks the main thread — work yields to the event loop on a frame budget.
  • Per-phase progress — drive real loading states (cloneembedrasterizeencode).
  • Cancellable — pass an AbortSignal.
  • Huge content — PNG and PDF render in memory-bounded tiles, beyond the browser's single-canvas size limit.
  • Multi-formattoPng, toJpeg, toWebp, toSvg, toPdf, toBlob, toCanvas.
  • Zero runtime dependencies. Inline web worker, hand-written PDF, native compression.
npm install smooth-screenshot

Usage

import { toPng, toPdf, toSvg } from 'smooth-screenshot'

const node = document.querySelector('#capture')!

// PNG data URL
const url = await toPng(node)

// PDF blob
const pdf = await toPdf(node)

// SVG (vector, infinite zoom)
const svg = await toSvg(node)

Loading state that doesn't freeze

await toPng(node, {
  onProgress({ phase, overall }) {
    setLabel(phase) // 'clone' | 'embed' | 'rasterize' | 'encode'
    setBar(overall) // 0..1
  },
})

Cancellation

const controller = new AbortController()
cancelButton.onclick = () => controller.abort()

try {
  await toPng(node, { signal: controller.signal })
} catch (err) {
  if (err instanceof DOMException && err.name === 'AbortError') {
    // user cancelled
  }
}

Options

| Option | Default | Description | | --- | --- | --- | | type | 'png' | Image format for toBlob (png | jpeg | webp). | | quality | 0.92 | 0–1 for lossy formats. | | scale | devicePixelRatio | Output pixel density (alias: pixelRatio). | | backgroundColor | transparent | Background painted behind the element (JPEG defaults to white). | | width / height | element size | Force output dimensions (CSS px). | | crop | — | { x, y, width, height } — capture a sub-region. Use for full-res sections of very large content. | | style | — | Inline styles (CSS property names) applied to the clone root — reframe/restyle output without touching the live DOM. | | signal | — | AbortSignal to cancel the capture. | | onProgress | — | (p: { phase, phaseRatio, overall }) => void. | | frameBudgetMs | 5 | Main-thread time per slice before yielding. | | worker | true | Offload resource fetching to an inline worker. false or { count }. | | maxTileSize | 4096 | Tile edge (device px) before tiling kicks in. | | filter | — | (node) => boolean to exclude nodes. | | fonts | — | { skip?, preferWoff2? }. | | fetch | — | { requestInit?, placeholder?, timeoutMs?, retries? }. | | onResourceError | — | (url, error) => void — a failed resource doesn't fail the capture. |

Notes & limits

  • Very large content: toPng and toPdf render at full resolution via tiling. toJpeg / toWebp / toCanvas are bound by the browser's single-canvas size limit and are downscaled to fit when exceeded. To export huge content crisply in those formats, capture sections with crop.
  • Cross-origin resources must allow CORS, otherwise they can't be embedded and are replaced with a transparent placeholder (see onResourceError).
  • Browser support: requires CompressionStream for tiled PNG/PDF output (Chrome 80+, Firefox 113+, Safari 16.4+).

License

MIT © Luccas Carvalho