• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

QR/bar code scanner for the Browser

=koder=

QR/bar code scanner for the Browser

npm Build Status License: MIT

πŸ’‘ Demo

https://koder-prod.web.app

πŸš€ Features

  • QR/barcode module implemented in WebAssembly
  • Barcode support (ISBN, UPC-A, UPC-E, EAN-8, EAN-13, I25, ITF-14, CODE-128, CODE-39, CODE-93, CODABAR, DATABAR)
  • Uses Zbar C++ library (version 0.23.90)
  • Packaged as PWA (caching files with Service Worker, Add to Home Screen)
  • Mobile first (can be used on a Laptop as well)
  • Multiplatform (iOS, Android, Desktop)
  • QR/bar code recognition logic is performed off the browser's Main thread (i.e. Web Worker)
  • koder React component supports a jsqr based Web Worker (see jsQrWorker.js)
  • Emscripten-zbar-sdk Docker image based on emscripten/emsdk, Dockerfile
  • ReactJS component
  • Vanilla JS example
  • πŸ†• Turn on/off the beep sound
  • πŸ†• Support for UPN QR (Slovenia only)
  • πŸ†• EU Digital Covid Certificate validator (vaccination, test), works in offline mode!
  • πŸ†• Emscripten v3.1.1
  • πŸ†• npm package

⚑ Usage

Install dependencies

npm install --global yarn
yarn install --frozen-lockfile

Run React app

npm run start
open https://locahost:8080

Productionize

npm run build                # -> build React app into ./public
npm run prod                 # -> serve static web app on port 8082
open http://localhost:8082

⚑ NPM module

npm install @maslick/koder
// CommonJS
const Koder = require('@maslick/koder');

// ES6 modules
import Koder from '@maslick/koder';
const Koder = require('@maslick/koder');
const {loadImage, createCanvas} = require("canvas");

const getImageData = async (src) => {
  const img = await loadImage(src);
  const canvas = createCanvas(img.width, img.height);
  const ctx = canvas.getContext('2d');
  ctx.drawImage(img, 0, 0);
  return {
    data: ctx.getImageData(0, 0, img.width, img.height).data,
    width: img.width,
    height: img.height
  };
};

(async () => {
  const url = 'https://raw.githubusercontent.com/maslick/koder/master/screenshots/app_1.png';
  const koder = await new Koder().initialized;
  const {data, width, height} = await getImageData(url);

  const t0 = new Date().getTime();
  const res = koder.decode(data, width, height);
  const t1 = new Date().getTime();

  console.log(`Scanned in ${t1-t0} ms`);  // Scanned in 7 ms
  console.log(res);                       // http://en.m.wikipedia.org
})();

♠️ Development

Fetch or build the Builder image

docker pull maslick/emscripten-zbar-sdk
docker build -t maslick/emscripten-zbar-sdk -f docker/Dockerfile docker

Build WASM artifacts

# React app
docker run \
  -e INPUT_FILE=zbar/qr.cpp \
  -e OUTPUT_FILE=zbar \
  -e OUTPUT_DIR=public/wasm \
  -v $(pwd):/app \
  maslick/emscripten-zbar-sdk make -B

Clean the build artifacts (if necessary):

# React app
OUTPUT_DIR=public/wasm OUTPUT_FILE=zbar make clean

πŸ”­ References

More Repositories

1

keycloak-android-native

Android native client for Keycloak
Kotlin
40
star
2

keycloak-docker

Docker image for Keycloak 6.0.1 (postgres, ssl) + k8s + Openshift
Dockerfile
21
star
3

radiaSlider

circular/linear knob-style slider
JavaScript
19
star
4

brauzie

Awesome CLI for fetching JWT tokens for OAuth2.0 clients
JavaScript
14
star
5

koder-vanilla-js

Vanilla JS example using Koder
JavaScript
9
star
6

minimalka

Lightweight Docker image for JDK 11 micro-services
Dockerfile
7
star
7

grafana-telegram-proxy

sending Grafana alarm messages to Telegram via the Webhook channel
Go
3
star
8

barkoder

a minimalistic WMS system, back-end
Kotlin
3
star
9

webtupoj

cloud native web2py app
Python
3
star
10

karandashee

time series plot for categorical data
JavaScript
3
star
11

telega

HTTP proxy for sending messages to Telegram group chats
Go
2
star
12

formuljar

a simple web form with extra security
JavaScript
2
star
13

hazzelcuster

HaaS (Hazelcast-as-a-Service)
Java
2
star
14

revolutto

test assignment for Revolut
Kotlin
2
star
15

covid-decoder

COVID-19 certificate parser/validator API
Go
2
star
16

klassy

Weka classification wrapper
Java
2
star
17

govolutto

Golang version of money transfer REST API
Go
2
star
18

aws-ricky

aws-lambda-ric example
JavaScript
1
star
19

redirector

Blazing fast 301/302 redirects with Lambda@Edge
JavaScript
1
star
20

realtor

real estate broker regression model using Klassy
Java
1
star
21

pythonoid

AWS API Gateway, Lambda, DynamoDB, S3, SAM showcase
Shell
1
star
22

collector

Basic time-series operations with collections
Kotlin
1
star
23

fargater

Run batch/migration jobs in your VPC using Fargate
HCL
1
star
24

certifications

My personal certificates
1
star
25

kliker-ui

JavaScript
1
star
26

daNgger

Java
1
star
27

kodermobilj

Android native client for barkoder
Kotlin
1
star
28

kliker

Java
1
star
29

apps7

statistics collector for ad providers
Java
1
star
30

fluxish

webflux demo
Java
1
star
31

iriska

Iris flower classification model
Java
1
star
32

apiman-docker

Docker image for Apiman 1.1.9 (postgres, SSL/TLS, elasticsearch)
Shell
1
star
33

realtimer

distributed event bus showcase
Kotlin
1
star
34

angularchik

runtime-configurable static angular web-app
TypeScript
1
star
35

d3revo

HTML
1
star