Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

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.