npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

javascript-barcode-reader

v1.0.0

Published

Simple & Fast Barcode decoder for Browser and Node.js

Readme

Javascript-Barcode-Reader

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, MSI, and Pharmacode.

Build Status codecov npm version License: MIT

NPM

Try now

https://codesandbox.io/s/javascript-barcode-reader-liium

Available decoders

  • EAN-13
  • EAN-8
  • UPC-A
  • UPC-E
  • Code-39
  • Code-93
  • Code-2of5
    • standard
    • Interleaved
  • Codabar
  • Code-128 (UCC/EAN-128)
  • MSI
  • Pharmacode

Features

  • Pure JavaScript/TypeScript implementation
  • Works in both Node.js and browser environments
  • Supports multiple barcode formats
  • Adaptive thresholding for challenging images
  • Single-pass mode for faster decoding
  • Automatic barcode region detection
  • Automatic rotation detection and correction
  • TypeScript support

Installation

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

Usage

Node.js

import javascriptBarcodeReader from 'javascript-barcode-reader'

javascriptBarcodeReader({
  /* Image file Path || {data: Uint8ClampedArray, width, height} || HTML5 Canvas ImageData */
  image: source,
  barcode: 'code-2of5',
  // barcodeType: 'industrial', // for code-2of5: 'industrial' or 'interleaved'
  options: {
    // useAdaptiveThreshold: true // for images with shaded/ gradient portions
    // singlePass: true
    // detectRotation: true // auto-detect and correct rotation
    // locateBarcode: true // auto-locate barcode region
  },
})
  .then((code) => {
    console.log(code)
  })
  .catch((err) => {
    console.log(err)
  })

Browser

javascriptBarcodeReader will be available as global in Browsers.

javascriptBarcodeReader({
  /* Image ID || HTML5 Image || HTML5 Canvas || HTML5 Canvas ImageData || Image URL */
  image: source,
  barcode: 'code-2of5',
  // barcodeType: 'industrial', // for code-2of5: 'industrial' or 'interleaved'
  options: {
    // useAdaptiveThreshold: true // for images with shaded/ gradient portions
    // singlePass: true
    // detectRotation: true // auto-detect and correct rotation
    // locateBarcode: true // auto-locate barcode region
  },
})
  .then((code) => {
    console.log(code)
  })
  .catch((err) => {
    console.log(err)
  })

Supported Barcode Types

| Barcode Type | Value | | ------------ | -------------- | | EAN-13 | 'ean-13' | | EAN-8 | 'ean-8' | | UPC-A | 'upc-a' | | UPC-E | 'upc-e' | | Code-39 | 'code-39' | | Code-93 | 'code-93' | | Code-2of5 | 'code-2of5' | | Codabar | 'codabar' | | Code-128 | 'code-128' | | MSI | 'msi' | | Pharmacode | 'pharmacode' |

Options

  • useAdaptiveThreshold: Apply adaptive thresholding for images with shading or gradients
  • singlePass: Use single-pass decoding for faster processing
  • detectRotation: Automatically detect and correct barcode rotation
  • locateBarcode: Automatically locate barcode region in image

Note

  • For best results, ensure barcode is relatively straight in the image
  • Works best when barcode occupies most of the image

Contributing

  • Each decoder is defined in src directory as a module.
  • Tests are defined in the test directory using Jest.

Publishing

If you have 2FA enabled on npm, use:

npm publish --otp=123456

Replace 123456 with the 6-digit code from your authenticator app.

License

MIT