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

0.1.3 • Public • Published

wasm-qrcode

A QR Code WebAssembly library implemented with Rust.

Methods

qrcode(data: string, width: number, height: number)

Generate the SVG format QR Code image with the given data and image widht/height.


qrcode_base64(data: string, width: number, height: number)

Generate a base64 encoded SVG QR Code image with the given data and image widht/height.

Example

import * as wasm from "wasm-qrcode";

window.onload = function() {
  const qr_b64img = wasm.qrcode_base64(
    "https://github.com/yishiashia",
    36, 36
  );
  const img = document.createElement('img');

  img.src = `data:image/svg+xml;base64,${qr_b64img}`;
  img.alt = "QR Code";
  img.style.width = "100px";
  img.style.height = "100px";

  document.body.append(img);
}

Package Sidebar

Install

npm i @yishiashia/wasm-qrcode

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

79.6 kB

Total Files

6

Last publish

Collaborators

  • yishiashia