Headless QR Code Generator In JavaScript

Category: Javascript | April 24, 2023
Author:Rich-Harris
Views Total:144 views
Official Page:Go to website
Last Update:April 24, 2023
License:MIT

Preview:

Headless QR Code Generator In JavaScript

Description:

A simple headless QR code generator that allows developers to programmatically create QR codes containing an n x n array of booleans, where `true` is a dark pixel.

How to use it:

1. Import the qs module.

import { qr } from 'headless-qr';

2. Generate a QR code from the data you provide.

const myQR = qr('https://www. cssscript.com');
// output [
  [
    true,
    true,
    true,
    true,
    true,
    true,
    true,
    false,
    true,
    false,
    true,
    false,
    false,
    true,
    false,
    false,
    false,
    false,
    true,
    true,
    true,
    true,
    true,
    true,
    true
  ],
  // ...
]

3. Specify the version and error correction level.

const myQR = qr('https://www. cssscript.com',{
      version: 40, // 1 - 40
      correction: 'Q' // L, M, Q or H
});

You Might Be Interested In:


Leave a Reply