镜像自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
lijingbo8119 0e3c7c4a05 add: package-lock.json 6 years ago
.github test 6 years ago
config feat: add aio.min build 7 years ago
demo feat: update demo 7 years ago
doc feat: init project 7 years ago
src fix: resove crossOrigin issue 6 years ago
test feat: update rollup config and demo 7 years ago
.babelrc feat: update rollup config and demo 7 years ago
.editorconfig feat: init project 7 years ago
.eslintignore feat: init project 7 years ago
.eslintrc.js feat: init project 7 years ago
.gitignore feat: init project 7 years ago
.npmignore feat: init project 7 years ago
.travis.yml feat: init project 7 years ago
CHANGELOG.md feat: init project 7 years ago
LICENSE Initial commit 7 years ago
README.md feat: init project 7 years ago
README.zh-CN.md feat: init project 7 years ago
TODO.md feat: init project 7 years ago
package-lock.json add: package-lock.json 6 years ago
package.json fix: clear black bg after camera capture 7 years ago
yarn.lock feat: update rollup config and demo 7 years ago

README.md

qrcode-decoder

license Build Status NPM downloads

简体中文 | 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 npm to install.

$ npm install --save qrcode-decoder

Using in webpack:

import QrcodeDecoder from 'qrcode-decoder';

Using in browser:

<script src="node_modules/qrcode-decoder/dist/index.aio.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:

$ npm install

Build code:

$ npm run build

Run unit test:

$ npm test

Modify version in package.json, run release script:

$ npm run release

Publish

$ npm publish

License

MIT