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 🙏

© 2025 – Pkg Stats / Ryan Hefner

remote-debug-screenshot

v0.1.0

Published

A tiny React component that adds a floating bottom-right "Debug Screenshot" button to your app. One click captures the whole page/tab and uploads it to a server endpoint for debugging purposes.

Downloads

7

Readme

remote-debug-screenshot

A tiny React component that adds a floating bottom-right "Debug Screenshot" button to your app. One click captures the whole page/tab and uploads it to a server endpoint for debugging purposes.

  • Primary capture: getDisplayMedia (whole tab), when supported
  • Fallback: html2canvas (full page render) with iOS/WebKit size clamping and optional downscale
  • No extra build tooling required — consume the package as source in a monorepo or publish it as-is

Installation

Monorepo local (recommended during development):

{
  "dependencies": {
    "remote-debug-screenshot": "file:../qr-debug-screenshot"
  }
}

or, after publishing to a registry:

npm i remote-debug-screenshot

Peer deps:

  • react >= 18
  • react-dom >= 18

Usage

import { DebugScreenshotButton } from 'remote-debug-screenshot';

export default function App() {
  return (
    <>
      {/* ... your app ... */}
      <DebugScreenshotButton
        uploadUrl="/upload-screenshot"
        source="qr-scanner-client"
        componentName="DebugScreenshot"
        notePrefix="Whole-page screenshot"
        size={56}
        tooltip="Debug Screenshot"
      />
    </>
  );
}

The button appears bottom-right, floating above your UI. Click it to capture and POST to uploadUrl.

Server endpoint

Expected payload (JSON):

{
  "clientId": "client_...",
  "source": "qr-scanner-client",
  "component": "DebugScreenshot",
  "note": "Whole-page screenshot via ...",
  "dataURL": "data:image/jpeg;base64,..."
}

The endpoint should decode the Base64 image and save it. In a Vite dev server, you can set up a middleware like:

server.middlewares.use('/upload-screenshot', (req, res, next) => { /* ... */ });

Props

  • uploadUrl (string): URL to POST the screenshot. Default: /upload-screenshot.
  • clientId (string): Provide your own client/session id. Default: generated and stored in sessionStorage.
  • source (string): Logical source. Default: qr-debug-screenshot.
  • componentName (string): Logical component name. Default: DebugScreenshotButton.
  • notePrefix (string): Prefix for the note field. Default: Whole-page screenshot.
  • size (number): Button diameter (px). Default: 56.
  • tooltip (string): Tooltip/ARIA label. Default: Debug Screenshot.
  • style (React.CSSProperties): Inline style overrides for the button container.
  • onUploadStart / onUploadSuccess / onUploadError: Optional hooks.

Behavior and limitations

  • On browsers without getDisplayMedia (e.g., iOS Chrome), the fallback uses html2canvas which renders DOM to canvas. Videos/iframes/cross-origin content may not render identically.
  • Large pages on iOS/WebKit are clamped (~16384px). The component downsamples and annotates the note with TRUNCATED info.
  • The component intentionally does not show visible progress text to avoid polluting the captured image.

Security

  • For development only. Do not expose the upload endpoint publicly without authentication and rate limiting.
  • Use HTTPS origins; many browsers block media capture on insecure contexts.

Styling

  • The button is a circular, frosted-glass style container with a small camera-like SVG. Override via the style prop if desired.

Development (local link workflow)

When working in a monorepo alongside a consumer app (e.g., qr-scanner-client/), you can use npm link for rapid iteration without publishing:

# In this package (remote-debug-screenshot/)
npm run build
npm link

# In the consumer app (qr-scanner-client/)
npm link remote-debug-screenshot

# Start the consumer app
npm run dev

To unlink and go back to the registry version inside the consumer app:

# In qr-scanner-client/
npm unlink remote-debug-screenshot && npm i

Tip: You can add helper scripts in the consumer app's package.json:

{
  "scripts": {
    "link:dev": "npm link remote-debug-screenshot",
    "unlink:dev": "npm unlink remote-debug-screenshot && npm i"
  }
}

Publishing

This package is configured to publish compiled artifacts from dist/ and mark the package as public.

Steps to publish a new version:

# 1) Bump version (choose patch/minor/major)
npm version patch

# 2) Build artifacts
npm run build

# 3) Publish to registry (requires prior npm login)
npm publish --access public

After publishing, consumers can install/update via:

npm i remote-debug-screenshot@latest

License

MIT