You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

qrcode

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qrcode

QRCode / 2d Barcode api with both server side and client side support using canvas


Version published
Weekly downloads
2.4M
increased by0.86%
Maintainers
0
Install size
86.9 kB
Created
Weekly downloads
 

Package description

What is qrcode?

The qrcode npm package is a library for generating QR codes. It can be used to create QR codes in various formats such as images or canvas for web applications, and it supports a range of customization options.

What are qrcode's main functionalities?

Generating QR Code as Data URL

This feature allows you to generate a QR code as a data URL, which can be used directly in image tags or CSS backgrounds.

const QRCode = require('qrcode');
QRCode.toDataURL('https://www.example.com', function (err, url) {
  console.log(url);
});

Generating QR Code as PNG Image File

This feature allows you to generate a QR code and save it as a PNG image file on the filesystem.

const QRCode = require('qrcode');
QRCode.toFile('path/to/output.png', 'https://www.example.com', function (err) {
  if (err) throw err;
  console.log('QR Code saved as image file!');
});

Generating QR Code as UTF8 String

This feature allows you to generate a QR code as a UTF8 string, which can be printed to the terminal or used in text-based formats.

const QRCode = require('qrcode');
QRCode.toString('https://www.example.com', { type: 'terminal' }, function (err, string) {
  if (err) throw err;
  console.log(string);
});

Other packages similar to qrcode

Readme

Source

This is a node js server side QR code / 2d barcode generator. it is an extension of "QRCode for JavaScript" which Kazuhiko Arase thankfully mit licensed

the qrcode-draw.js can be used directly as a client side lib if its appended too or included with lib/qrcode.js to use this on the server side please require('qrcode'); =)

install:

npm install qrcode

dependencies:

npm install canvas

api: QRCode.draw(text,cb(error,canvas)); returns node canvas object see https://github.com/LearnBoost/node-canvas for all of the cool node things you can do look up the canvas api for the other cool things

QRCode.toDataURL(text,cb(error,dataURL));
	returns mime image/png data url for the 2d barcode 

QRCode.save(path,text,cb(error,written));
	saves png to the path specified returns bytes

examples: ---code--- // simple test var sys = require('sys'); var QRCode = require('qrcode');

QRCode.toDataURL('i am a pony!',function(err,url){
	sys.print(url);
});

--- execute ---
node ./tests/url.js


for server use
	see tests/server.js

for client side use
	open tests/clientside.html in your browser

The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED

Keywords

FAQs

Package last updated on 27 Dec 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc