@qrcodesdk/cli
v0.0.1
Published
@qrcodesdk/cli provides the qrc command for generating QR codes as terminal text, SVG files, or PNG files.
Maintainers
Readme
@qrcodesdk/cli
@qrcodesdk/cli generates QR codes from a terminal, shell script, or CI job. The qrc command prints compact UTF-8 terminal text or writes SVG and PNG files.
Runtime requirements
When executed with Node.js, @qrcodesdk/cli requires Node 22.12.0 or newer. Packed consumers are
verified in CI on Node 22.12.0 and the latest Node 24.x release. The Deno and Bun commands below
use those runtimes' Node compatibility layers and are not covered by the Node compatibility job.
Install
Install it globally when you want qrc available as a command anywhere:
npm install -g @qrcodesdk/clipnpm add -g @qrcodesdk/clivp
vp install -g @qrcodesdk/clideno
deno install --global @qrcodesdk/clibun
bun add -g @qrcodesdk/cliyarn
yarn global add @qrcodesdk/cliYou can also run it from a project dependency.
npm install -D @qrcodesdk/clipnpm add -D @qrcodesdk/clivp
vp add -D @qrcodesdk/clideno
deno add --dev @qrcodesdk/clibun
bun add -D @qrcodesdk/cliyarn
yarn add -D @qrcodesdk/clinpx qrc "https://qrcodesdk.dev"pnpm exec qrc "https://qrcodesdk.dev"vp
vp exec qrc "https://qrcodesdk.dev"deno
deno x npm:@qrcodesdk/cli/qrc "https://qrcodesdk.dev"bun
bunx qrc "https://qrcodesdk.dev"yarn
yarn qrc "https://qrcodesdk.dev"Or use it without installing it.
npx @qrcodesdk/cli "https://qrcodesdk.dev"pnpm dlx @qrcodesdk/cli "https://qrcodesdk.dev"vp
vp dlx @qrcodesdk/cli "https://qrcodesdk.dev"deno
deno x npm:@qrcodesdk/cli/qrc "https://qrcodesdk.dev"bun
bunx @qrcodesdk/cli "https://qrcodesdk.dev"yarn
yarn dlx @qrcodesdk/cli "https://qrcodesdk.dev"Print terminal text
Without an output file, qrc packs two QR rows into each terminal line and applies ANSI colors:
qrc "https://qrcodesdk.dev"Use full-height, double-width ██ modules when preferred:
qrc "https://qrcodesdk.dev" --no-smallDisable ANSI styling explicitly for logs, files, and redirected output:
qrc "https://qrcodesdk.dev" --no-ansi-colorsRender modules entirely as ANSI-colored spaces, without UTF-8 block glyphs:
qrc "https://qrcodesdk.dev" --only-ansi-colorsThe equivalent explicit boolean forms are --small false and --ansi-colors false. Both options also accept true. Layout and ANSI styling are independent and affect text output only. Compact and full block layouts require UTF-8; ANSI-background-only output contains spaces and escape sequences instead. ANSI remains enabled by default when standard output is redirected; the CLI does not inspect TTY state or NO_COLOR.
--only-ansi-colors ignores the small setting and implies ANSI output. It cannot be combined with --no-ansi-colors or --ansi-colors false.
Write SVG's
An .svg output path selects SVG automatically:
qrc "https://qrcodesdk.dev" --output qrcode.svgYou can also set the format explicitly:
qrc "https://qrcodesdk.dev" --format svg --output qrcode.svgWrite PNGs
An .png output path selects PNG automatically:
qrc "https://qrcodesdk.dev" --output qrcode.pngOr pass the format explicitly:
qrc "https://qrcodesdk.dev" --format png --output qrcode.pngSVG and PNG output require --output. If the extension is not .svg or .png, pass --format explicitly.
Customize output
qrc "https://qrcodesdk.dev" \
--output qrcode.svg \
--error-correction H \
--size 2 \
--margin 3 \
--color-dark '#111827' \
--color-light '#ffffff' \
--aria-label 'Scan to open qrcodesdk.dev'Most applications can leave the data mode, version, and mask on automatic selection. Pin them when you need a compatibility target or deterministic fixture:
qrc "HELLO WORLD" \
--mode alphanumeric \
--version 1 \
--mask 2 \
--output hello.svgOptions
| Option | Description | Default |
| --------------------------------------- | ----------------------------------------------------------- | :---------- |
| [data] | Positional QR code input data. | - |
| --input <value> | QR code input data, equivalent to positional [data]. | - |
| -V | Print the installed CLI package version. | - |
| --format <text\|svg\|png> | Output format. Inferred from .svg or .png output paths. | - |
| -o, --output <path> | Required output path for SVG and PNG. | - |
| --mode <numeric\|alphanumeric\|octet> | QR code data mode. | Auto |
| --error-correction <L\|M\|Q\|H> | Error correction level. | M |
| --version <1-40> | Pin a QR code version. | Auto |
| --mask <0-7> | Pin a QR code mask. | Auto |
| --size <number> | Module size as a positive integer. | 1 |
| --margin <number> | Margin as a non-negative integer. | 2 |
| --small <true\|false> | Pack two QR rows into each terminal line. | true |
| --no-small | Alias for --small false. | - |
| --ansi-colors <true\|false> | Style terminal text with ANSI colors. | true |
| --no-ansi-colors | Alias for --ansi-colors false. | - |
| --only-ansi-colors | Use ANSI background cells without UTF-8 block glyphs. | false |
| --color-dark <#rrggbb> | Dark module color. | #000000 |
| --color-light <#rrggbb> | Light module color. | #ffffff |
| --alt <text> | SVG alt text. | undefined |
| --aria-label <text> | SVG aria-label. | undefined |
| --title <text> | SVG title. | undefined |
Colors must be six-digit hex values. --size must be positive and --margin must be non-negative. For block-glyph text output, the dark color is the ANSI foreground and the light color is the ANSI background. With --only-ansi-colors, both become module background colors.
Interactive and automated use
In an interactive terminal, qrc prompts only for missing required values such as input, an ambiguous format, or a file output path.
In a non-interactive shell or CI job, missing required values fail with a clear error instead of opening a prompt. Pass every required value explicitly:
qrc \
--input "https://qrcodesdk.dev" \
--format png \
--output artifacts/qrcode.pngSuccessful file output writes a confirmation to standard error, leaving standard output available for terminal QR code content and pipeline use.
