Skip to content

CLI: qrforge ​

The qrforge command generates QR codes from a terminal or script. It is built on @qrforge/core and works offline.

bash
npm install -g @qrforge/cli
# or without installing
npx @qrforge/cli generate https://example.com

Requires Node.js 18+.

Examples ​

bash
qrforge generate https://example.com                  # preview in the terminal
qrforge generate https://example.com --format svg     # writes ./qrcode.svg
qrforge generate https://example.com --output qr.svg  # format inferred from the extension
qrforge wifi --ssid HomeNetwork --password 'correct horse' -o wifi.png
qrforge --help
qrforge --version

Output destination ​

FlagsResult
Neither --output nor --formatThe code is drawn in the terminal with a summary of the payload.
--format <fmt> onlyqrcode.<fmt> is written to the current directory.
--output <file><file> is written; format from .svg / .png / .pdf.
--output -Raw output to stdout (SVG by default). PNG/PDF bytes are refused when stdout is a terminal.
-t, --terminalAlso show the terminal preview (on stderr when writing a file).

Commands ​

CommandRequiredOther flags
generate <data>data (- reads stdin)—
url <url>urlAdds https:// if no scheme is given
text <text>text—
wifi--ssid, --password (unless nopass)--encryption WPA|WEP|nopass, --hidden
vcard--first/--last or --org--title --phone --mobile --email --website --street --city --region --zip --country --note
email--to--subject --body --cc --bcc
sms--phone--message
phone <number>number—
location--lat + --lng, or --address--map geo|osm|google|apple
calendar / event--title, --start--end --all-day --location --description (ISO 8601 dates)

Run qrforge help <command> or qrforge <command> --help for details.

bash
qrforge vcard --first Ada --last Lovelace --org "Analytical Engines" --email ada@example.com -o ada.svg
qrforge location --address "Eiffel Tower, Paris" --map osm
qrforge event --title "Launch party" --start 2026-05-01T18:00:00Z --end 2026-05-01T21:00:00Z -o launch.pdf
echo "https://example.com" | qrforge generate - -o qr.svg

Style and output options ​

OptionDescription
--formatsvg, png, pdf
-o, --outputOutput file, or - for stdout
--sizeWidth in pixels (default 512)
--marginQuiet zone in modules (default 4)
--eccL, M (default), Q or H. Defaults to H when --logo is used.
--fg, --bg, --transparentColors
--stylesquare, rounded, soft, dots
--corner, --corner-dot, --corner-colorFinder patterns
--logo <file>, --logo-sizeLogo (PNG for PNG/PDF output; any image for SVG)
--label <text>Text under the code (SVG and PDF)
--frame, --frame-colornone, box, banner
--preset <id>minimal, business, modern, rounded, dark, elegant
--page-sizePDF page: fit, A4, Letter, A5

Labels in PNG

Text labels in PNG need a browser canvas. In the CLI (Node.js), use SVG or PDF for labelled codes.

Use in scripts ​

  • Reliability warnings, such as low contrast, a missing quiet zone or an oversized logo, are printed to stderr.
  • When stdin is a terminal, the CLI prompts for missing required fields and masks Wi-Fi passwords. Otherwise it exits with code 1 and lists the missing flags.
  • Exit codes: 0 for success, 1 for usage or input errors, 2 for unexpected errors. Set QRFORGE_DEBUG=1 to print a stack trace.
  • Colored output respects NO_COLOR.

Released under the MIT License.