{"_id":"@bybrave/qrcode-terminal2","_rev":"2-2b79a102626b17f8a8c70c49b3a779ca","name":"@bybrave/qrcode-terminal2","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@bybrave/qrcode-terminal2","version":"1.0.0","keywords":["ansi","ascii","qrcode","qr","terminal","console","cli","typescript","esm"],"author":{"url":"https://github.com/bybraveHQ","name":"bybrave"},"license":"Apache-2.0","_id":"@bybrave/qrcode-terminal2@1.0.0","maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"contributors":[{"url":"author of the original qrcode-terminal","name":"Gord Tanner"},{"url":"author of the original qrcode-terminal","name":"Michael Brooks"}],"homepage":"https://github.com/bybraveHQ/qrcode-terminal2#readme","bugs":{"url":"https://github.com/bybraveHQ/qrcode-terminal2/issues"},"bin":{"qrcode-terminal2":"bin/qrcode-terminal.js"},"dist":{"shasum":"0c9996bba5f194e57b8d6cb360f1c3cd35f5a95f","tarball":"https://registry.npmjs.org/@bybrave/qrcode-terminal2/-/qrcode-terminal2-1.0.0.tgz","fileCount":18,"integrity":"sha512-45VlzJGNJmKNaNiNZgUCUvXtFw7zdWpuLKyRce+18NaWz46EnGsvU7Ir2AUQNpY37AJ+3lwcf3d9Rl6jD0LgZg==","signatures":[{"sig":"MEUCIDVy3Tw4Mq+roDtI4ZgOaqn//LjJPdrV6kEzvJRk3LNKAiEA0vguBxFGTrP9EuKTsmjRXw7TINN4P7KhOqoXxiNr9wQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54131},"main":"lib/main.js","types":"index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./index.d.ts","import":"./index.mjs","require":"./lib/main.js"},"./package.json":"./package.json"},"funding":"https://ko-fi.com/bybrave","gitHead":"62081a704d625e7eec61606614168d78be999ad4","scripts":{"test":"node --test test/*.test.js","test-types":"tsc --noEmit --strict test/type-declarations.ts"},"_npmUser":{"name":"bybrave","email":"opmybrave@gmail.com"},"repository":{"url":"git+https://github.com/bybraveHQ/qrcode-terminal2.git","type":"git"},"_npmVersion":"10.8.2","description":"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","directories":{},"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/qrcode-terminal2_1.0.0_1783295632723_0.1016059002592149","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bybrave/qrcode-terminal2","version":"1.0.1","description":"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","main":"lib/main.js","types":"index.d.ts","bin":{"qrcode-terminal2":"bin/qrcode-terminal.js"},"exports":{".":{"types":"./index.d.ts","import":"./index.mjs","require":"./lib/main.js"},"./package.json":"./package.json"},"scripts":{"test":"node --test test/*.test.js","test-types":"tsc --noEmit --strict test/type-declarations.ts"},"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/qrcode-terminal2.git"},"bugs":{"url":"https://github.com/bybraveHQ/qrcode-terminal2/issues"},"homepage":"https://github.com/bybraveHQ/qrcode-terminal2#readme","keywords":["ansi","ascii","qrcode","qr","terminal","console","cli","typescript","esm"],"author":{"name":"bybrave","url":"https://github.com/bybraveHQ"},"contributors":[{"name":"Gord Tanner","url":"author of the original qrcode-terminal"},{"name":"Michael Brooks","url":"author of the original qrcode-terminal"}],"license":"Apache-2.0","funding":"https://ko-fi.com/bybrave","engines":{"node":">=18"},"devDependencies":{"@types/node":"^20.14.0","typescript":"^5.5.0"},"_id":"@bybrave/qrcode-terminal2@1.0.1","gitHead":"7528ca0e66d7bfa7eb90ce3e26741efe4600047d","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-xBklbq+oTLeAiK6IIXX48PchJ4d4m+eYmaMJjMkv70PZ9Lv5gVPA0hl0GFZyTNPgZZdC1LN6XkY9XykPiG3nWA==","shasum":"a41af0be56d7f54a681c8aad9047b1d554686c52","tarball":"https://registry.npmjs.org/@bybrave/qrcode-terminal2/-/qrcode-terminal2-1.0.1.tgz","fileCount":18,"unpackedSize":54498,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDN70J0FRIYBYQAUhAPnP1TBO1p9EouBmwopbSQFFtThAIhAJqdhL6q/I2hhWMCoTuvRjKKnH3BH+6hy+Kt/doNtkou"}]},"_npmUser":{"name":"bybrave","email":"opmybrave@gmail.com"},"directories":{},"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/qrcode-terminal2_1.0.1_1783297303169_0.09197797397069873"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-05T23:53:52.595Z","modified":"2026-07-06T00:21:43.424Z","1.0.0":"2026-07-05T23:53:52.855Z","1.0.1":"2026-07-06T00:21:43.311Z"},"bugs":{"url":"https://github.com/bybraveHQ/qrcode-terminal2/issues"},"author":{"name":"bybrave","url":"https://github.com/bybraveHQ"},"license":"Apache-2.0","homepage":"https://github.com/bybraveHQ/qrcode-terminal2#readme","keywords":["ansi","ascii","qrcode","qr","terminal","console","cli","typescript","esm"],"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/qrcode-terminal2.git"},"description":"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","contributors":[{"name":"Gord Tanner","url":"author of the original qrcode-terminal"},{"name":"Michael Brooks","url":"author of the original qrcode-terminal"}],"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"readme":"# @bybrave/qrcode-terminal2\n\n[![CI](https://github.com/bybraveHQ/qrcode-terminal2/actions/workflows/ci.yml/badge.svg)](https://github.com/bybraveHQ/qrcode-terminal2/actions)\n[![npm](https://img.shields.io/npm/v/%40bybrave%2Fqrcode-terminal2)](https://www.npmjs.com/package/@bybrave/qrcode-terminal2)\n\nMaintained fork of [`qrcode-terminal`](https://github.com/gtanner/qrcode-terminal) — render QR codes as text in the terminal — with **dual ESM + CommonJS, bundled TypeScript types, and a strict-mode/ESM fix**.\n\nThe 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.\n\n```bash\nnpm install @bybrave/qrcode-terminal2\n```\n\n```js\n// CommonJS — drop-in\nconst qrcode = require('@bybrave/qrcode-terminal2');\nqrcode.generate('https://example.com');\n\n// ESM — default or named import\nimport qrcode from '@bybrave/qrcode-terminal2';\nimport { generate, setErrorLevel } from '@bybrave/qrcode-terminal2';\n\n// TypeScript types built in — no @types/qrcode-terminal needed\n```\n\n## Usage\n\n```js\nconst qrcode = require('@bybrave/qrcode-terminal2');\n\n// Print a QR code\nqrcode.generate('https://example.com');\n\n// Smaller half-block rendering\nqrcode.generate('https://example.com', { small: true });\n\n// Get the string instead of printing (callback or return value)\nqrcode.generate('https://example.com', (code) => console.log(code));\nconst code = qrcode.generate('https://example.com', { small: true }); // also returned\n\n// Error-correction level: 'L' (default) | 'M' | 'Q' | 'H'\nqrcode.setErrorLevel('H');\nqrcode.generate('https://example.com');\n```\n\n### CLI\n\n```bash\n# installed globally as `qrcode-terminal2`\nqrcode-terminal2 \"hello world\"\necho \"https://example.com\" | qrcode-terminal2\nqrcode-terminal2 --help\nqrcode-terminal2 --version\n```\n\n## Why this fork\n\n| Fixed / improved | Original issue |\n|---|---|\n| **Built-in TypeScript types** — replaces the separate `@types/qrcode-terminal` package | [#27](https://github.com/gtanner/qrcode-terminal/issues/27) |\n| **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](https://github.com/gtanner/qrcode-terminal/issues/52) |\n| **`generate()` returns the string** — in addition to the callback / `console.log`, so you can capture output without a callback | [#24](https://github.com/gtanner/qrcode-terminal/issues/24) |\n| **Dual ESM + CommonJS** — `import` and `require` both work | — |\n\nThe QR generation engine (`vendor/QRCode`, a port of Kazuhiko Arase's *QR Code for JavaScript*) and the terminal rendering are unchanged from `qrcode-terminal@0.12.0`, gated by a byte-for-byte golden test. The octal→hex escape change produces identical bytes (`\\033` === `\\x1b` === ESC).\n\n## Migration\n\nDrop-in — change the dependency name:\n\n```diff\n- const qrcode = require('qrcode-terminal');\n+ const qrcode = require('@bybrave/qrcode-terminal2');\n```\n\n```diff\n- \"qrcode-terminal\": \"^0.12.0\",\n- \"@types/qrcode-terminal\": \"^0.12.0\",\n+ \"@bybrave/qrcode-terminal2\": \"^1.0.0\",\n```\n\nRemove `@types/qrcode-terminal` — the types ship with this package. **Requires Node.js >= 18.**\n\n## Known limitations (by design)\n\n- **Small QR codes may not scan on some terminal fonts** ([#21](https://github.com/gtanner/qrcode-terminal/issues/21), [#44](https://github.com/gtanner/qrcode-terminal/issues/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.\n- **You can't set an arbitrary pixel size** ([#51](https://github.com/gtanner/qrcode-terminal/issues/51), [#9](https://github.com/gtanner/qrcode-terminal/issues/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.\n\n## Support\n\nIf this package saves you time, you can support maintenance:\n\n[![Ko-fi](https://img.shields.io/badge/Ko--fi-buy%20me%20a%20coffee-FF5E5B?logo=kofi&logoColor=white)](https://ko-fi.com/bybrave)\n[![Bitcoin](https://img.shields.io/badge/Bitcoin-BTC-F7931A?logo=bitcoin&logoColor=white)](#support)\n\nBitcoin (BTC): `bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q`\n\n## License\n\nApache-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](./LICENSE) and [NOTICE](./NOTICE).\n","readmeFilename":"README.md"}