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.
![]() |
3 years ago | |
---|---|---|
.github | 3 years ago | |
__tests__ | 3 years ago | |
demo | 3 years ago | |
doc | 5 years ago | |
scripts | 3 years ago | |
src | 3 years ago | |
.babelrc | 5 years ago | |
.editorconfig | 5 years ago | |
.gitignore | 3 years ago | |
.npmignore | 4 years ago | |
.npmrc | 3 years ago | |
.prettierignore | 5 years ago | |
.prettierrc | 5 years ago | |
LICENSE | 7 years ago | |
README.md | 3 years ago | |
README.zh-CN.md | 3 years ago | |
TODO.md | 7 years ago | |
jest.config.js | 3 years ago | |
package.json | 3 years ago | |
pnpm-lock.yaml | 3 years ago | |
tsconfig.json | 4 years ago | |
tslint.json | 5 years ago |
README.md
qrcode-decoder
简体中文 | 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);
});
decodeFromVideo(videoElem, options)
Decodes directly from a video with a well specified src
attribute
qr.decodeFromVideo(videoElement).then((res) => {
console.log(res);
});
decodeFromCamera(videoElem, options)
Decodes from a videoElement.
qr.decodeFromCamera(videoElem).then((res) => {
console.log(res);
});
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