Socket
Socket
Sign inDemoInstall

barcode-js

Package Overview
Dependencies
91
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    barcode-js

A node addon to perform barcode recognition and analysis


Version published
Weekly downloads
17
increased by88.89%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

BarcodeXpress

What is Barcode Xpress

Barcode Xpress for Node.js enables developers to add the ability to read common industry 1D and 2D barcodes in their applications.

  • Barcode Types - recognize over 30 different types of barcodes.
  • Structured Results - results are organized in a hierarchical model where every barcode has a value, type, confidence, and location.
  • Simple - by providing only a minimal asynchronous API, Barcode Xpress is easy to learn. With a few lines of code, recognize barcodes found in images produced by scanners, cameras, or fax machines.

Getting Started

  1. Make sure you have the following system requirements:
    • Windows x64 operating systems of the following versions:
      • Windows 8.1
      • Windows 10
      • Windows Server 2012 (and R2)
      • Windows Server 2016
      • Windows Server 2019
    • Linux x64 operating systems of the following versions:
      • Ubuntu 18.04
      • Ubuntu 20.04
      • CentOS 7
      • CentOS 8
      • Debian 9
      • Debian 10
    • Node.js versions 12, 14, 16 and npm (to check the version use the following command: node -v)
  2. Clone and run the Hello Barcode Xpress for Node.js Sample

Although Barcode Xpress for Node.js may run, it is not supported on earlier operating system versions (for example, Ubuntu 14.04 or Windows 7).

Reading Barcodes

// Import packages.
const bx = require("barcode-js");

// Set up logging function.
const logResults = (results) => console.log(JSON.stringify(results, ["type", "value", "confidence"], 2));

// Set up analysis function.
const analyzeBarcodes = async (filePath) => {
    try {
        const results = await bx.analyze(filePath);
        logResults(results);
    }
    catch(err) {
        console.error(`Fatal: Error analyzing image input\n${err}`);
    }
};

// Set up parameters.
// Accepted file types are bmp, tiff, jpg, gif, png, and url
const filePath = "test.bmp";

// Call analyze.
analyzeBarcodes(filePath);

Accessing Results

The analyze method returns an array of result objects.

Each result object has the following structure:

{
    "type": barcodeType,
    "value": barcodeValue,
    "area": {
        "x": xCoordinateBarcodeStart,
        "y": yCoordinateBarcodeStart,
        "height": barcodeHeight,
        "width": barcodeWidth
    },
    "corners": [
    {
        "x": xCoordinateTopLeft,
        "y": yCoordinateTopLeft
    },
    {
        "x": xCoordinateTopRight,
        "y": yCoordinateTopRight
    },
        {
        "x": xCoordinateBottomRight,
        "y": yCoordinateBottomRight
    },
        {
        "x": xCoordinateBottomLeft,
        "y": yCoordinateBottomLeft
    }
    ],
    "confidence": recognitionConfidence
}

For example, to get the confidence of a recognized barcode:

const barcodeValue = result.confidence;

or to get the height property of a recognized barcode:

const barcodeHeight = result.area.height;

Licensing

Barcode Xpress for Node.js comes with an evaluation license pre-installed, so you can get started right away.

For development and deployment licenses, and more information on licensing in general, please visit our online documention at https://help.accusoft.com/BarcodeXpress/v13.9/BxNodeJs/webframe.html.

In order to run the license manager, you will need:

  • java -version JRE 1.8 or later.

More Documentation and Support

Barcode Xpress also includes detailed API documentation and a Getting Started guide.

Keywords

FAQs

Last updated on 26 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc