Skip to content

Commit 1200c36

Browse files
committed
chore: add more decoders
1 parent 68127ee commit 1200c36

72 files changed

Lines changed: 22007 additions & 43287 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
# Javascript-Barcode-Reader
22

3-
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.
3+
Simple & Fast Barcode decoder for Browsers and Node.js capable of reading multiple barcode formats including Code128 (UCC/EAN-128), Code93, Code39, Standard/Industrial 2 of 5, Interleaved 2 of 5, Codabar, EAN-13, EAN-8, UPC-A, UPC-E, and MSI barcodes.
44

55
[![Build Status](https://travis-ci.org/mubaidr/Javascript-Barcode-Reader.svg?branch=master)](https://travis-ci.org/mubaidr/Javascript-Barcode-Reader)
6-
[![codebeat badge](https://codebeat.co/badges/8f27170b-909e-489f-ae93-459664c47422)](https://codebeat.co/projects/github-com-mubaidr-javascript-barcode-reader-master)
76
[![codecov](https://codecov.io/gh/mubaidr/Javascript-Barcode-Reader/branch/master/graph/badge.svg)](https://codecov.io/gh/mubaidr/Javascript-Barcode-Reader)
8-
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
9-
[![Rate on Openbase](https://badges.openbase.com/js/rating/javascript-barcode-reader.svg)](https://openbase.com/js/javascript-barcode-reader?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
7+
[![npm version](https://img.shields.io/npm/v/javascript-barcode-reader.svg)](https://www.npmjs.com/package/javascript-barcode-reader)
8+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
109

1110
[![NPM](https://nodei.co/npm/javascript-barcode-reader.png)](https://nodei.co/npm/javascript-barcode-reader/)
1211

13-
<a href="https://patreon.com/mubaidr">
14-
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="45">
15-
</a>
16-
1712
## Try now
1813

1914
https://codesandbox.io/s/javascript-barcode-reader-liium
@@ -22,17 +17,27 @@ https://codesandbox.io/s/javascript-barcode-reader-liium
2217

2318
- EAN-13
2419
- EAN-8
20+
- UPC-A
21+
- UPC-E
2522
- Code-39
2623
- Code-93
2724
- Code-2of5
2825
- standard
2926
- Interleaved
3027
- Codabar
3128
- Code-128 (UCC/EAN-128)
29+
- MSI
30+
31+
## Features
3232

33-
## How to use
33+
- Pure JavaScript/TypeScript implementation
34+
- Works in both Node.js and browser environments
35+
- Supports multiple barcode formats
36+
- Adaptive thresholding for challenging images
37+
- Single-pass mode for faster decoding
38+
- TypeScript support
3439

35-
### Install
40+
## Installation
3641

3742
Recommended way to install is by using package manager (npm, yarn etc):
3843

@@ -50,6 +55,8 @@ or download manually:
5055

5156
[javascript-barcode-reader](https://unpkg.com/javascript-barcode-reader)
5257

58+
## Usage
59+
5360
### Node.js
5461

5562
```ts
@@ -59,16 +66,16 @@ javascriptBarcodeReader({
5966
/* Image file Path || {data: Uint8ClampedArray, width, height} || HTML5 Canvas ImageData */
6067
image: source,
6168
barcode: 'code-2of5',
62-
// barcodeType: 'industrial',
63-
options: {
69+
// barcodeType: 'industrial', // for code-2of5: 'industrial' or 'interleaved'
70+
options: {
6471
// useAdaptiveThreshold: true // for images with shaded/ gradient portions
6572
// singlePass: true
66-
}
73+
},
6774
})
68-
.then(code => {
75+
.then((code) => {
6976
console.log(code)
7077
})
71-
.catch(err => {
78+
.catch((err) => {
7279
console.log(err)
7380
})
7481
```
@@ -82,20 +89,40 @@ javascriptBarcodeReader({
8289
/* Image ID || HTML5 Image || HTML5 Canvas || HTML5 Canvas ImageData || Image URL */
8390
image: source,
8491
barcode: 'code-2of5',
85-
// barcodeType: 'industrial',
92+
// barcodeType: 'industrial', // for code-2of5: 'industrial' or 'interleaved'
8693
options: {
8794
// useAdaptiveThreshold: true // for images with shaded/ gradient portions
8895
// singlePass: true
89-
}
96+
},
9097
})
91-
.then(code => {
98+
.then((code) => {
9299
console.log(code)
93100
})
94-
.catch(err => {
101+
.catch((err) => {
95102
console.log(err)
96103
})
97104
```
98105

106+
### Supported Barcode Types
107+
108+
| Barcode Type | Value |
109+
| ------------ | ------------- |
110+
| EAN-13 | `'ean-13'` |
111+
| EAN-8 | `'ean-8'` |
112+
| UPC-A | `'upc-a'` |
113+
| UPC-E | `'upc-e'` |
114+
| Code-39 | `'code-39'` |
115+
| Code-93 | `'code-93'` |
116+
| Code-2of5 | `'code-2of5'` |
117+
| Codabar | `'codabar'` |
118+
| Code-128 | `'code-128'` |
119+
| MSI | `'msi'` |
120+
121+
## Options
122+
123+
- `useAdaptiveThreshold`: Apply adaptive thresholding for images with shading or gradients
124+
- `singlePass`: Use single-pass decoding for faster processing
125+
99126
## Note
100127

101128
- This script does not implement logic to locate/rotate barcode in the given image.
@@ -104,16 +131,8 @@ javascriptBarcodeReader({
104131
## Contributing
105132

106133
- Each decoder is defined in `src` directory as a module.
107-
- Tests are defined in the `tests` directory using `Jest`.
108-
109-
## Contributors
110-
111-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
112-
113-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
114-
<!-- prettier-ignore -->
115-
<table><tr><td align="center"><a href="https://github.com/nitescuc"><img src="https://avatars0.githubusercontent.com/u/1108077?v=4" width="100px;" alt="Cristian Nitescu"/><br /><sub><b>Cristian Nitescu</b></sub></a><br /><a href="https://github.com/mubaidr/Javascript-Barcode-Reader/commits?author=nitescuc" title="Code">💻</a></td></tr></table>
134+
- Tests are defined in the `test` directory using `Jest`.
116135

117-
<!-- ALL-CONTRIBUTORS-LIST:END -->
136+
## License
118137

119-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
138+
MIT

docs/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

0 commit comments

Comments
 (0)