Skip to content

Rich-Harris/headless-qr

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
April 18, 2023 11:00
April 17, 2023 21:05
April 17, 2023 21:38
April 17, 2023 21:27
April 17, 2023 21:38
April 16, 2023 19:20
April 17, 2023 21:19

headless-qr

A simple, modern QR code generator. Adapted from https://github.com/kazuhikoarase/qrcode-generator but without all the junk that was necessary 10 years ago.

Usage

import { qr } from 'headless-qr';

// generate an n x n array of booleans,
// where `true` is a dark pixel
const modules = qr('https://example.com');

// specify version and error correction
const modules = qr('https://example.com', {
	version: 40, // 1 - 40, will select the best version if unspecified
	correction: 'Q' // L, M, Q or H
});