Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simon-laux/quircs_wasm
wasm bindings for the quircs qrcode scanner library
https://github.com/simon-laux/quircs_wasm
Last synced: 4 days ago
JSON representation
wasm bindings for the quircs qrcode scanner library
- Host: GitHub
- URL: https://github.com/simon-laux/quircs_wasm
- Owner: Simon-Laux
- License: mit
- Created: 2022-05-29T00:05:52.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-05T03:43:38.000Z (over 1 year ago)
- Last Synced: 2024-12-01T13:43:16.145Z (22 days ago)
- Language: TypeScript
- Homepage: https://simon-laux.github.io/quircs_wasm/
- Size: 1.44 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# quircs in wasm
wasm bindings for the [quircs](https://github.com/dignifiedquire/quircs) qrcode scanner library.
## Usage
### Browser
```ts
import init, { read_qrcodes_from_image_data } from "quircs-wasm";await init("./quircs_wasm_bg.wasm");
var context = canvas.getContext("2d");
// draw your image onto the canvas (from an image file or video input of a camera)
// context.drawImage(video, 0, 0, canvas.width, canvas.height);
const img_data = context.getImageData(0, 0, canvas.width, canvas.height);
const res = read_qrcodes_from_image_data(img_data, true);
for (let qr of res) {
if (qr.data["content"]) {
const data = qr.data["content"];
console.log(qr.corners, ":", data.payload)
} else {
console.log("error reading qr code at", qr.corners, ":", qr.data["error"]);
}
}
```## Building
### 🛠️ Build with `wasm-pack build`
```
wasm-pack build --target web
```### 🔬 Test in Headless Browsers with `wasm-pack test`
```
wasm-pack test --headless --firefox
```### 🎁 Publish to NPM with `wasm-pack publish`
```
wasm-pack publish
```