MCPcopy
hub / github.com/zxing-js/library

github.com/zxing-js/library @v0.23.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.23.0 ↗
2,379 symbols 6,294 edges 358 files 544 documented · 23%
README

ZXing

Looking for an actively maintained barcode scanning library with commercial support? Check out STRICH – Barcode Scanning for Web Apps.

Project in Maintenance Mode Only

[!WARNING] The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enhancements will be considered. There is otherwise no active development or roadmap for this project. It is "DIY".

Attention

NOTE: While we do not have the time to actively maintain zxing-js anymore, we are open to new maintainers taking the lead.

What is ZXing?

ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

Supported Formats

See Projects and Milestones for what is currently done and what's planned next. 👀

1D product 1D industrial 2D
UPC-A Code 39 QR Code
UPC-E Code 93 Data Matrix
EAN-8 Code 128 Aztec
EAN-13 Codabar PDF 417
ITF MaxiCode (needs testing!)
RSS-14
RSS-Expanded (not production ready!)
Micro-QR (needs testing!)

Status

Maintainer wanted Greenkeeper badge

NPM version npm Contributors Commits to deploy

Maintainability Test Coverage

Demo

See Live Preview in browser.

Note: All the examples are using ES6, be sure is supported in your browser or modify as needed, Chrome recommended.

Installation

npm i @zxing/library --save

or

yarn add @zxing/library

Limitations

On iOS-Devices with iOS < 14.3 camera access works only in native Safari and not in other Browsers (Chrome,...) or Apps that use an UIWebView or WKWebView. This is not a restriction of this library but of the limited WebRTC support by Apple. The behavior might change in iOS 11.3 (Apr 2018?, not tested) as stated here

iOS 14.3 (released in december 2020) now supports WebRTC in 3rd party browsers as well 🎉

Browser Support

The browser layer is using the MediaDevices web API which is not supported by older browsers.

You can use external polyfills like WebRTC adapter to increase browser compatibility.

Also, note that the library is using the TypedArray (Int32Array, Uint8ClampedArray, etc.) which are not available in older browsers (e.g. Android 4 default browser).

You can use core-js to add support to these browsers.

In the PDF 417 decoder recent addition, the library now makes use of the new BigInt type, which is not supported by all browsers as well. There's no way to polyfill that and ponyfill libraries are way to big, but even if PDF 417 decoding relies on BigInt the rest of the library shall work ok in browsers that doesn't support it.

There's no polyfills for BigInt in the way it's coded in here.

Usage

// use with commonJS
const { MultiFormatReader, BarcodeFormat } = require('@zxing/library');
// or with ES6 modules
import { MultiFormatReader, BarcodeFormat } from '@zxing/library';

const hints = new Map();
const formats = [BarcodeFormat.QR_CODE, BarcodeFormat.DATA_MATRIX/*, ...*/];

hints.set(DecodeHintType.POSSIBLE_FORMATS, formats);

const reader = new MultiFormatReader();

const luminanceSource = new RGBLuminanceSource(imgByteArray, imgWidth, imgHeight);
const binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));

reader.decode(binaryBitmap, hints);

Contributing

See Contributing Guide for information regarding porting approach and reasoning behind some of the approaches taken.

Contributors

Special thanks to all the contributors who have contributed for this project. We heartly thankful to you all.

And a special thanks to @aleris who created the project itself and made available the initial QR code port.


Extension points exported contracts — how you extend this code

Reader (Interface)
* Implementations of this interface can decode an image of a barcode in some format into * the it: string encodes. For [16 …
src/core/Reader.ts
MaskCondition (Interface)
(no doc)
src/test/core/qrcode/decoder/DataMask.spec.ts
Writer (Interface)
* The base class for all objects which encode/generate a barcode image. * * @author dswitkin@google.com (Daniel Switki [20 …
src/core/Writer.ts
Encoder (Interface)
(no doc) [9 implementers]
src/core/datamatrix/encoder/Encoder.ts
ResultPointCallback (Interface)
* Callback which is invoked when a possible result point (significant * point in the barcode image such as a corner) is
src/core/ResultPointCallback.ts
MultipleBarcodeReader (Interface)
(no doc) [2 implementers]
src/core/multi/MultipleBarcodeReader.ts

Core symbols most depended-on inside this repo

get
called by 258
src/core/common/BitArray.ts
append
called by 239
src/core/util/StringBuilder.ts
set
called by 190
src/core/common/BitArray.ts
assertEquals
called by 151
src/test/core/util/AssertUtils.ts
getY
called by 122
src/core/aztec/detector/Detector.ts
getX
called by 118
src/core/aztec/detector/Detector.ts
toString
called by 108
src/core/Result.ts
setNumber
called by 107
src/core/qrcode/encoder/ByteMatrix.ts

Shape

Method 1,638
Class 542
Function 178
Enum 14
Interface 7

Languages

TypeScript91%
Java9%

Modules by API surface

src/browser/BrowserCodeReader.ts61 symbols
src/core/datamatrix/encoder/MinimalEncoder.ts47 symbols
src/test/core/oned/rss/expanded/expanded/RSSExpandedImage2stringTestCase.java29 symbols
src/test/core/oned/rss/expanded/RSSExpandedImage2stringTestCase.java29 symbols
src/core/pdf417/decoder/PDF417ScanningDecoder.ts28 symbols
src/core/common/BitArray.ts28 symbols
src/core/aztec/detector/Detector.ts28 symbols
src/core/qrcode/encoder/Encoder.ts27 symbols
src/core/common/BitMatrix.ts26 symbols
src/core/pdf417/PDF417ResultMetadata.ts24 symbols
src/core/oned/rss/expanded/RSSExpandedReader.ts23 symbols
src/core/datamatrix/decoder/Version.ts23 symbols

Dependencies from manifests, versioned

@eslint/js10.0.1 · 1×
@rollup/plugin-node-resolve16.0.3 · 1×
@types/jest30.0.0 · 1×
@types/node25.6.0 · 1×
@types/seedrandom3.0.8 · 1×
@typescript-eslint/eslint-plugin8.59.0 · 1×
@typescript-eslint/parser8.59.0 · 1×
@zxing/text-encoding0.9.0 · 1×
eslint10.2.1 · 1×
jest30.3.0 · 1×
rollup4.60.2 · 1×
seedrandom3.0.5 · 1×

For agents

$ claude mcp add library \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact