@jungvonmatt/qr-generator
v1.0.0
Published
Generate QR code images from URLs — CLI with JSON config and flags
Readme
@jungvonmatt/qr-generator
Generate QR code images from URLs via CLI.
- npm: https://www.npmjs.com/package/@jungvonmatt/qr-generator
- web tool: https://qr-generator-jade-five.vercel.app
- agent SKILL: https://github.com/jungvonmatt/qr-generator/blob/main/.agents/SKILL.md
Quickstart
npx @jungvonmatt/qr-generator generate "https://example.com"
npx @jungvonmatt/qr-generator generate urls.txt
npx @jungvonmatt/qr-generator lookup "https://example.com"
npx @jungvonmatt/qr-generator validate:config
npx @jungvonmatt/qr-generator validate:input urls.txt
npx @jungvonmatt/qr-generator helpCommands
generate <url> [url...] | <input-file> [options]: Create files from one or many URLs, or from a TXT input file.lookup <url> [options]: Compute the output filename for a URL without writing files.validate:config [options]: Validate effective config (defaults + file + CLI flags).validate:input <file> [options]: Validate TXT input file contents and filename collisions.help: Show help for the CLI or a specific command.
Input format
generate accepts two modes:
- URL mode: one or many positional HTTP(S) URLs.
- File mode: one positional TXT file path.
TXT input rules:
- One value per line.
- URL validation is enabled by default (
validateUrls: true). - Use
--no-validate-urlsto allow non-URL values.
Output files
Output files are written to output/{outputFolder}.
Filenames are derived from the slugged URL.
Use filenameAddHash to avoid collisions and lookup to find out the generated filename.
Per default, existing files are overwritten overwriteDuplicates.
Config
Config merge order (last one wins):
- Built-in defaults.
qr-config.jsonin current directory, or--config <path>. Disable file loading with--no-config-file.- CLI flags.
Config with defaults:
{
"outputFolder": "",
"format": "png",
"size": 512,
"color": "#000000",
"background": "#ffffff",
"overwriteDuplicates": true,
"validateUrls": true,
"filenameAddHash": false,
"filenameToLowercase": false
}Important flags:
--format <svg|png>--size <integer>--output-folder <name>--color <color>--background <color>--overwrite-duplicates/--no-overwrite-duplicates--validate-urls/--no-validate-urls--filename-add-hash/--no-filename-add-hash--filename-to-lowercase/--no-filename-to-lowercase
Color options:
- Color: any
#rgbor#rrggbbhex color orcurrentColorfor SVGs - Background: any
#rgbor#rrggbbhex color ortransparent
Examples
npx @jungvonmatt/qr-generator generate "https://example.com"
npx @jungvonmatt/qr-generator generate urls.txt --format svg --color "currentColor" --background "transparent"
npx @jungvonmatt/qr-generator lookup "https://example.com" --filename-add-hash
npx @jungvonmatt/qr-generator validate:config --config ./qr-config.json
npx @jungvonmatt/qr-generator validate:input urls.txtDevelopment
npm install
npm run checkLocal CLI (same router as the published package):
npm run qr:generate -- "https://example.com"
npm run qr:lookup -- "https://example.com"
npm run qr:validate:config
npm run qr:validate:input -- input/urls.txtUse -- with npm run so flags and URLs are passed to the script, not npm. With npx, no -- is needed.
Release
npm run releaseand push.
