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

@rjanjic/qr-url

v1.0.1

Published

Tiny zero-dependency QR code generator with SVG output. Pure TypeScript, ESM.

Readme

@rjanjic/qr-url

Tiny zero-dependency QR code generator with SVG output. Pure TypeScript, ESM.

  • ~7 KB gzipped, no runtime dependencies
  • All QR versions 1–40, all four error-correction levels (L/M/Q/H)
  • UTF-8 byte mode (works for URLs and arbitrary text)
  • Single merged <path> SVG output with crisp pixel rendering
  • Works in Node 16+, modern browsers, and any bundler

Install

npm install @rjanjic/qr-url

Usage

import { generate, renderSVG } from '@rjanjic/qr-url';

const qr = generate('https://example.com', 'M');
// → { modules: Uint8Array, size: 25, version: 2, mask: 2 }

const svg = renderSVG(qr);
// → '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 33 33" ...'

Browser via <script type="module">

<script type="importmap">
  { "imports": { "@rjanjic/qr-url": "https://esm.sh/@rjanjic/qr-url" } }
</script>
<script type="module">
  import { generate, renderSVG } from '@rjanjic/qr-url';
  document.body.innerHTML = renderSVG(generate('https://example.com'));
</script>

API

generate(text, ecLevel?)

| param | type | default | description | | ---------- | ----------------------------- | ------- | -------------------------------------- | | text | string | — | Any UTF-8 text. URLs are byte-encoded. | | ecLevel | 'L' \| 'M' \| 'Q' \| 'H' | 'M' | Error correction level. |

Returns QRCode = { modules: Uint8Array, size: number, version: number, mask: number }. modules[r * size + c] is 1 for dark, 0 for light.

Throws if ecLevel is invalid or the input exceeds v40 capacity (~2953 bytes at EC-L).

renderSVG(qr, options?)

| option | type | default | description | | -------- | -------- | ------- | -------------------------------------------- | | quiet | number | 4 | Quiet-zone width in modules (spec min is 4). | | fg | string | '#000'| Foreground color. | | bg | string | '#fff'| Background color. |

Returns a complete <svg>…</svg> string sized in module units. Scale it with CSS (width: 100%).

Error correction levels

| Level | Recovery | Use when | | ----- | -------- | --------------------------------- | | L | ~7 % | Pristine on-screen / web URLs. | | M | ~15 % | Default. Good general purpose. | | Q | ~25 % | Printed, may get scuffed. | | H | ~30 % | Stickers, harsh environments. |

Development

npm install
npm test        # builds + runs 102 tests (structural, byte-exact vs reference encoder, decode round-trip)
npm run serve   # serves demo/ on :8765
npm run build   # tsc → dist/

License

MIT