Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

javascript-barcode-reader

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-barcode-reader

Simple & Fast Barcode decoder for Browser and Node.js

  • 0.6.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-10.25%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Build Status codebeat badge codecov All Contributors Rate on Openbase

NPM

Try now

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

Available decoders

  • EAN-13
  • EAN-8
  • Code-39
  • Code-93
  • Code-2of5
    • standard
    • Interleaved
  • 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 file Path || {data: Uint8ClampedArray, width, height} || HTML5 Canvas ImageData */
  image: source,
  barcode: 'code-2of5',
  // barcodeType: 'industrial',
  options: {    
    // useAdaptiveThreshold: true // for images with sahded portions
    // singlePass: true
  }
})
  .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',
  options: {
    // useAdaptiveThreshold: true // for images with sahded portions
    // singlePass: true
  }
})
  .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):

Cristian Nitescu
Cristian Nitescu

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 08 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc