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

@bybrave/qrcode-terminal2

v1.0.1

Published

Maintained fork of qrcode-terminal — render QR codes in the terminal, with dual ESM+CJS, bundled TypeScript types (no separate @types/qrcode-terminal), and a strict-mode/ESM fix

Readme

@bybrave/qrcode-terminal2

CI npm

Maintained fork of qrcode-terminal — render QR codes as text in the terminal — with dual ESM + CommonJS, bundled TypeScript types, and a strict-mode/ESM fix.

The original has ~30M downloads/month and no release since March 2018. It's already dependency-free (the QR engine is vendored in), so this fork keeps the rendering byte-for-byte identical and focuses on what modern consumers were blocked on: ESM import, built-in types (no separate @types/qrcode-terminal), and source that survives a strict-mode / bundler build.

npm install @bybrave/qrcode-terminal2
// CommonJS — drop-in
const qrcode = require('@bybrave/qrcode-terminal2');
qrcode.generate('https://example.com');

// ESM — default or named import
import qrcode from '@bybrave/qrcode-terminal2';
import { generate, setErrorLevel } from '@bybrave/qrcode-terminal2';

// TypeScript types built in — no @types/qrcode-terminal needed

Usage

const qrcode = require('@bybrave/qrcode-terminal2');

// Print a QR code
qrcode.generate('https://example.com');

// Smaller half-block rendering
qrcode.generate('https://example.com', { small: true });

// Get the string instead of printing (callback or return value)
qrcode.generate('https://example.com', (code) => console.log(code));
const code = qrcode.generate('https://example.com', { small: true }); // also returned

// Error-correction level: 'L' (default) | 'M' | 'Q' | 'H'
qrcode.setErrorLevel('H');
qrcode.generate('https://example.com');

CLI

# installed globally as `qrcode-terminal2`
qrcode-terminal2 "hello world"
echo "https://example.com" | qrcode-terminal2
qrcode-terminal2 --help
qrcode-terminal2 --version

Why this fork

| Fixed / improved | Original issue | |---|---| | Built-in TypeScript types — replaces the separate @types/qrcode-terminal package | #27 | | Strict-mode / ESM safe — ANSI escapes rewritten from octal \033 to hex \x1b, so the source no longer throws Octal literal in strict mode under ESM or a bundler | #52 | | generate() returns the string — in addition to the callback / console.log, so you can capture output without a callback | #24 | | Dual ESM + CommonJSimport and require both work | — |

The QR generation engine (vendor/QRCode, a port of Kazuhiko Arase's QR Code for JavaScript) and the terminal rendering are unchanged from [email protected], gated by a byte-for-byte golden test. The octal→hex escape change produces identical bytes (\033 === \x1b === ESC).

Migration

Drop-in — change the dependency name:

- const qrcode = require('qrcode-terminal');
+ const qrcode = require('@bybrave/qrcode-terminal2');
- "qrcode-terminal": "^0.12.0",
- "@types/qrcode-terminal": "^0.12.0",
+ "@bybrave/qrcode-terminal2": "^1.0.0",

Remove @types/qrcode-terminal — the types ship with this package. Requires Node.js >= 18.

Known limitations (by design)

  • Small QR codes may not scan on some terminal fonts (#21, #44). The { small: true } half-block rendering packs two module rows into one character row; on fonts/terminals with non-square cells or line-height gaps the scanner can't resolve the modules. This is a terminal rendering constraint, not something the library can fix reliably — use a terminal with a square monospace font, or the default (larger) rendering, if a code won't scan.
  • You can't set an arbitrary pixel size (#51, #9). A QR code's dimensions are determined by how much data it encodes and the chosen version/error-correction level — it can't be stretched to a target width in the terminal. Shorten the payload or lower the error-correction level to get a smaller code.

Support

If this package saves you time, you can support maintenance:

Ko-fi Bitcoin

Bitcoin (BTC): bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q

License

Apache-2.0. Copyright (c) Gord Tanner and Michael Brooks (original qrcode-terminal); modifications copyright (c) 2026 bybrave. The vendored QR engine (vendor/QRCode) is MIT, copyright (c) 2009 Kazuhiko Arase. See LICENSE and NOTICE.