Generate QR code on your machine using Node.js

Generate QR code on your machine using Node.js Photo by David Dvořáček

I spoke at an event last week, and on the very last slide, I had a QR code that was supposed to lead people to my contacts page. Well, it didn't. I used a service for "free" QR code generation, and the link expired. So, I learned my lesson and came up with a line that generates whatever code I need right into my terminal.

First you need to install the qrcode NPM module via:

npm install -g qrcode

and then run

> read -p "Enter the text for the QR code: " userInput && qrcode -o qr.png "$userInput" -w 1000 -q 1

This will generate an image qr.png. Enjoy free QR code generation.

If you enjoy this post, share it on Twitter, Facebook or LinkedIn.

With over two decades of deep front-end expertise, I offer comprehensive web consultancy and stack audits, alongside specialized workshops, training, and engaging public speaking to elevate your team's skills and optimize your digital presence. Contact me.