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

easy-barcode-scanner

v10.4.3100

Published

A wrapper for dynamsoft-barcode-reader-javascript. Easier to use.

Readme

Easy Barcode Scanner

The Easy Barcode Scanner is a lightweight, user-friendly wrapper for the Dynamsoft Barcode Reader SDK. It simplifies the barcode scanning process, making it easier to integrate into your web applications with minimal effort.

Features

  • Supports video-based barcode scanning
  • Handles multiple barcodes with ease
  • Simple integration with just a few lines of code

Out-of-the-box Scanning

The simplest way to use Easy Barcode Scanner requires only one line code to create a video decoding web application.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dbr.bundle.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Dynamsoft/[email protected]/dist/easy-barcode-scanner.js"
  data-license=""></script>
<script>
  EasyBarcodeScanner.scan().then(txt=>alert(txt)).catch(ex=>alert(ex.message || ex));
</script>

Source Code >> | Run in github.io >>

Out-of-the-box Scanning

Create Your Own Scanner for Further Control

You can also create your own scanner instance to have more control over the entire workflow. For more details on the encapsulated functionality, refer to src/index.ts, and feel free to modify it based on your specific needs.

<div id="camera-view-container" style="height:90vh"></div>
<button id="btn-scan">scan</button>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dbr.bundle.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Dynamsoft/[email protected]/dist/easy-barcode-scanner.js"
  data-license=""></script>
<script>
  let pScanner, scanner;
  document.getElementById('btn-scan').addEventListener('click', async()=>{
    try{
      scanner = await (pScanner || (pScanner = EasyBarcodeScanner.createInstance()));
      // Optional. Insert the UI into the specified element.
      // Otherwise the UI will be inserted into `document.body`.
      document.querySelector("#camera-view-container").append(scanner.getUIElement());
      scanner.onUniqueRead = (txt) => { console.log(txt); };
      await scanner.open();
    }catch(ex){
      // If camera doesn't exist or is occupied, the camera may fail to open.
      // So it's better to use `try-catch`.
      console.error(ex);
      alert(ex.message || ex);
    }
  });
</script>

How to use it in frameworks like Angular, React, and Vue

To integrate Easy Barcode Scanner into your framework, follow these steps:

  1. Install the necessary package:
npm i [email protected] -E
  1. Copy the src/index.ts file from the library into your project. Rename it as needed, for example: [your-path]/easy-barcode-reader.ts.

Example 1: Simple Out-of-the-box Scan

For a simpler implementation, this example shows how to scan with a single function:

import EasyBarcodeScanner from '[your-path]/easy-barcode-reader';

EasyBarcodeScanner.license = ""; // Add your license key here

async scan(){
  try{
    alert(await EasyBarcodeScanner.scan());
  }catch(ex){
    console.error(ex);
    alert(ex.message || ex);
  }
}

Example 2: Setting Up a Scanner

This example shows how to create your own barcode scanner, giving you more control over the details:

import EasyBarcodeScanner from '[your-path]/easy-barcode-reader';

EasyBarcodeScanner.license = ""; // Add your license key here

let pScanner = null;
let scanner = null;

async mount(){
  try{
    scanner = await (pScanner || (pScanner = EasyBarcodeScanner.createInstance()));
    cameraViewContainer.append(scanner.getUIElement()); // Optional.
    scanner.onUniqueRead = (txt) => { console.log(txt); };
    await scanner.open();
  }catch(ex){
    console.error(ex);
    alert(ex.message || ex);
  }
}
beforeUnmount(){
  // Clean up to free resources
  try{ (await pScanner)?.dispose(); }catch(_){}
}

// usage example in a tsx/jsx component
<div ref={cameraViewContainer}></div>
  • The mount() function initializes the scanner and listens for barcode readings.
  • The beforeUnmount() function disposes of the scanner instance to prevent memory leaks.

Customize the UI

The built-in UIs are located in files like xxx.ui.html. You can copy xxx.ui.html into your project, modify it as needed, and pass its path to the createInstance or scan API to use the customized version.

// 'https://cdn.jsdelivr.net/gh/Dynamsoft/[email protected]/easy-barcode-scanner.ui.html' by default
EasyBarcodeScanner.scan(ui?: string|HTMLElement);
// 'https://cdn.jsdelivr.net/npm/[email protected]/dist/dce.mobile-native.ui.html' by default
EasyBarcodeScanner.createInstance(ui?: string|HTMLElement);

You can refer to customize the UI of CameraEnhancer for more details.

All supported barcodes

You can use the code snippet from theOut-of-the-box Scanning section to focus the camera on one or more barcodes. If only one barcode is detected, the result will be displayed immediately. If multiple codes are scanned, an additional interactive step allows you to choose the target.

default supported barcode

Please note that some barcode types are not supported by default for performance concern. Please check here to change settings.

License Information

The license used in this sample is an automatically requested trial license, only valid for 24 hours and applicable to any newly authorized browser. To test the SDK further, you can request a 30-day free trial license via the Request a Trial License link.

The license can be directly configured within the script tag when including the script file.

<script src="https://cdn.jsdelivr.net/gh/Dynamsoft/[email protected]/dist/easy-barcode-scanner.js"
data-license="[YOUR-LICENSE]"></script>