JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q75522F
  • License ISC

Generate QR code image

Package Exports

  • @sylvainneung/qr-code-generator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sylvainneung/qr-code-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

QR-code-generator

Simply generate your QR codes

  • Custom name
  • Custom data
  • Multiple formats supported : png, jpeg, jpg, svg
  • Path custom
  • Async / Sync

Maintenance

Required

  • npm >= 6.4.1
  • node > 7.6 (async / await support required)

Dependencies

Get started

$ npm i @sylvainneung/qr-code-generator --save

https://www.npmjs.com/package/@sylvainneung/qr-code-generator

Example

'use strict';

const qrGenerator = require('@sylvainneung/qr-code-generator');


//default directory root of your project

//Sync
qrGenerator.generateQrImage("mydata", "mypicname", "png", "my/dir/path/optional");


//Async
qrGenerator
    .generateQrImageAsync("myOtherData", "otherpic", "svg", "my/dir/path/optional")
    .then(response => {
        console.log("Data", response)
    })
    .catch(err => console.log("Err => ", err));

Documentation

Methods params description
generateQrImageAsync data, picName, picType, picPath Create new QR image asynchronous
generateQrImage data, picName, picType, picPath Create new QR image synchronous

Details params

Params Type description Infos
data String qr picture data Numeric only Max. 7,089 characters (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) / Alphanumeric Max. 4,296 characters (0–9, A–Z [upper-case only], space, $, %, *, +, -, ., /, :) / Binary/byte Max. 2,953 characters (8-bit bytes) (23624 bits)
picName String name of your file
picType String -> only support "svg" "png" "jpeg" "jpg" picture type
picPath String? (optional) folder path "my/folder/name"