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

qr-pure

v2.1.0

Published

Zero-dependency QR code generator written in TypeScript. Implements ISO/IEC 18004 standard.

Readme

qr-pure

npm CI License: MIT API Docs

Zero-dependency QR code generator written in TypeScript. Implements ISO/IEC 18004 standard.

Features

  • Zero dependencies for core functionality
  • Supports all 40 QR versions (21x21 to 177x177 modules)
  • 4 error correction levels: L (7%), M (15%), Q (25%), H (30%)
  • 3 encoding modes: Numeric, Alphanumeric, Byte with auto-detection
  • Automatic version and mask selection
  • 3 renderers: Canvas, SVG (with module shapes), Terminal (ASCII/Unicode)
  • Dual CJS + ESM build with TypeScript declarations
  • 350+ unit/integration tests + E2E verification with jsQR

Installation

npm install qr-pure

Usage

Quick Start

import { generateQR, renderToSVG, renderToTerminal } from "qr-pure";

// Generate QR matrix
const { matrix } = generateQR("Hello World");

// Render as SVG string
const svg = renderToSVG("Hello World", { scale: 10 });

// Print to terminal
console.log(renderToTerminal("Hello World"));

With Options

import { QRCode } from "qr-pure";

const qr = new QRCode("Hello World", {
	errorCorrectionLevel: "H", // L, M, Q, H
	version: "auto", // 1-40 or 'auto'
	mode: "auto", // numeric, alphanumeric, byte, or 'auto'
	mask: "auto", // 0-7 or 'auto'
});

const { matrix, version, size, mode, maskPattern } = qr.generate();

Render to Canvas

import { QRCode, CanvasRenderer } from "qr-pure";

const qr = new QRCode("Hello World");
const { matrix } = qr.generate();

const canvas = document.getElementById("qr-canvas") as HTMLCanvasElement;
CanvasRenderer.render(canvas, matrix, {
	scale: 10,
	margin: 4,
	darkColor: "#000000",
	lightColor: "#ffffff",
});

Render to SVG

import { SVGRenderer } from "qr-pure";

// Standard squares
const svg = SVGRenderer.render(matrix, { scale: 10 });

// Rounded modules
SVGRenderer.render(matrix, { moduleShape: "rounded", cornerRadius: 0.3 });

// Circle or dot modules
SVGRenderer.render(matrix, { moduleShape: "circle" });
SVGRenderer.render(matrix, { moduleShape: "dot" });

Render to Terminal

import { TerminalRenderer } from "qr-pure";

// Unicode blocks (best contrast)
console.log(TerminalRenderer.render(matrix));

// Compact mode (half height)
console.log(TerminalRenderer.render(matrix, { style: "compact" }));

// ASCII (max compatibility)
console.log(TerminalRenderer.render(matrix, { style: "ascii" }));

// Inverted for dark backgrounds
console.log(TerminalRenderer.render(matrix, { invert: true }));

API

QRCode

new QRCode(data: string, options?: QRCodeOptions)

Options:

  • errorCorrectionLevel: 'L' | 'M' | 'Q' | 'H' (default: 'M')
  • version: 1-40 | 'auto' (default: 'auto')
  • mode: 'numeric' | 'alphanumeric' | 'byte' | 'auto' (default: 'auto')
  • mask: 0-7 | 'auto' (default: 'auto')

Methods:

  • generate(): Returns { matrix, version, size, mode, maskPattern }

Helper Functions

generateQR(content, options?)           // → QRCodeResult
renderToCanvas(canvas, content, options?) // → void
renderToSVG(content, options?)          // → string
renderToTerminal(content, options?)     // → string

CanvasRenderer

CanvasRenderer.render(canvas, matrix, options?)
CanvasRenderer.toDataURL(matrix, options?)
CanvasRenderer.toBlob(matrix, options?)

SVGRenderer

SVGRenderer.render(matrix, options?)
// options: scale, margin, darkColor, lightColor, moduleShape, cornerRadius

TerminalRenderer

TerminalRenderer.render(matrix, options?)
// options: style ('unicode' | 'compact' | 'ascii'), margin, invert

Development

npm install          # Install dependencies
npm test             # Run tests
npm run build        # Build (dual CJS + ESM)
npm run typecheck    # Type checking
npm run lint         # Lint
npm run demo:node    # Run Node.js demo
npm run demo:browser # Start browser demo (Vite)

# E2E tests
cd e2e-tests && npm install && npm test

Documentation

License

MIT