Skip to content

A QR Code WebAssembly library implemented with Rust.

License

Notifications You must be signed in to change notification settings

yishiashia/wasm-qrcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

A QR Code WebAssembly library implemented with Rust.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages