Javascript-Barcode-Reader
Simple & Fast Barcode decoder for Browsers and Node.js capapable of reading Code128 (UCC/EAN-128), Code93, Code39, Standard/Industrial 2 of 5, Interleaved 2 of 5, Codabar and EAN-13 barcodes.
Try now
https://codesandbox.io/s/javascript-barcode-reader-liium
Available decoders
- EAN-13
- EAN-8
- Code-39
- Code-93
- Code-2of5
- Codabar
- Code-128 (UCC/EAN-128)
How to use
Install
Recommended way to install is by using package manager (npm, yarn etc):
npm i javascript-barcode-reader
or use cdn:
<script src="//unpkg.com/javascript-barcode-reader"></script>
or download manually:
javascript-barcode-reader
Node.js
import javascriptBarcodeReader from 'javascript-barcode-reader'
javascriptBarcodeReader({
image: source,
barcode: 'code-2of5',
options: {
}
})
.then(code => {
console.log(code)
})
.catch(err => {
console.log(err)
})
Browser
javascriptBarcodeReader
will be available as global in Browsers.
javascriptBarcodeReader({
image: source,
barcode: 'code-2of5',
options: {
}
})
.then(code => {
console.log(code)
})
.catch(err => {
console.log(err)
})
Note
- This script does not implement logic to locate/rotate barcode in the given image.
- Make sure the barcode image is the only thing in the image. Otherwise this script will most probably fail.
Contributing
- Each decoder is defined in
src
directory as a module. - Tests are defined in the
tests
directory using Jest
.
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!