qrcode-wasm
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

qrcode-wasm

DEMO

Web Assembly Qrcode generator

Usage

import { QrCodeWasm } from 'qrcode-wasm';
 
const generator = new QrCodeWasm({ debug: true });
 
generator.encode('HELLO WORLD').then(async (buffer) => {
    // buffer = Int32Array
    // [Side size of Matrix (total size = Side Size * Side Size), 1, 0, 1, 0, 0 ....]
    // 1 = Dark Module
    // 0 = White Module
 
    const dataURL = await generator.png(200 /* PNG size in Pixel */);
});

Webpack

If you want to use this package with webpack you must include the main.wasm file in your build output. You can customize the name or path to this file with the wasmPath option.

const generator = new QrCodeWasm({ wasmPath: 'scripts/custom.wasm' });

Errors

CODE DESCRIPTION
ERR_ENC Message encoding not supported
ERR_TLONG Message is too long

Build with

Typescript

Assemblyscript

Package Sidebar

Install

npm i qrcode-wasm

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

56.4 kB

Total Files

8

Last publish

Collaborators

  • wawrzyj