镜像自GitHub仓库
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
yugasun cfd924beab 0.3.4 1 year ago
.github chore: fix test ci 3 years ago
__tests__ chore: add type definition 3 years ago
demo fix: add decode code result type 1 year ago
doc feat: refactor with ts 5 years ago
scripts chore: add type definition 3 years ago
src fix: add decode code result type 1 year ago
.babelrc feat: refactor with ts 5 years ago
.editorconfig feat: refactor with ts 5 years ago
.gitignore fix: try to use rear camera by default 3 years ago
.npmignore fix: remove unuse file 4 years ago
.npmrc chore: add type definition 3 years ago
.prettierignore feat: refactor with ts 5 years ago
.prettierrc feat: refactor with ts 5 years ago
LICENSE Initial commit 7 years ago
README.md chore: update readme & ci 3 years ago
README.zh-CN.md chore: update readme & ci 3 years ago
TODO.md fix: add decode code result type 1 year ago
jest.config.js chore: add type definition 3 years ago
package.json 0.3.4 1 year ago
pnpm-lock.yaml fix: add decode code result type 1 year ago
tsconfig.json fix: add decode code result type 1 year ago
tslint.json feat: refactor with ts 5 years ago

README.md

qrcode-decoder

npm NPM downloads license

简体中文 | English

A tool for decoding qrcode.

Directory

.
├── demo            code demo
├── dist            build output
├── doc             docs
├── src             source code
├── test            unit test
├── CHANGELOG.md    change log
└── TODO.md         todo list

Guide

Use pnpm to install.

$ pnpm install --save qrcode-decoder

Using in webpack:

import QrcodeDecoder from 'qrcode-decoder';

Using in browser:

<script src="https://unpkg.com/qrcode-decoder@0.3.1/dist/index.min.js"></script>

Demo

QrcodeDecoder()

User new to create a decoder object.

var qr = new QrcodeDecoder();

decodeFromImage(img, options)

Decodes an image from url or an <img> element with a src attribute set.

qr.decodeFromImage(img).then((res) => {
  console.log(res);
});

Demo

decodeFromVideo(videoElem, options)

Decodes directly from a video with a well specified src attribute

qr.decodeFromVideo(videoElement).then((res) => {
  console.log(res);
});

Demo

decodeFromCamera(videoElem, options)

Decodes from a videoElement.

qr.decodeFromCamera(videoElem).then((res) => {
  console.log(res);
});

Demo

stop()

Stops the current qr from searching for a QRCode.

Develop

Install dependencies:

$ pnpm install

Build code:

$ pnpm run build

Run unit test:

$ pnpm test

Modify version in package.json, run release script:

$ pnpm run release

Publish

$ pnpm publish

License

MIT