Giter Site home page Giter Site logo

sridharcool0005 / node-usb-barcode-scanner-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iamdistractech/node-usb-barcode-scanner

0.0 1.0 0.0 31 KB

A simple barcode scanner with support for shift modifier key.

License: MIT License

JavaScript 100.00%

node-usb-barcode-scanner-1's Introduction

JS barcode scanner

Not maintained anymore

A simple barcode scanner with support for shift modifier key.

This package is specifically written for the Rakinda RD4500R USB barcode scanner, but can be used with other 'wedge' usb barcodescanners

Note: Since a wedge scanner is seen as a keyboard on the OS you need elevated rights on macOS or Linux to use the package. You can also specify a udev rule in Linux to own the scanner.

Installation

Use npm to install the package

npm install @isirthijs/barcode-scanner

Usage

Initialize

create a new instance of a scanner by passing the productID/vendorID or the path of the scanner into the constructor

const UsbScanner = require('@isirthijs/barcode-scanner');

// Using vendorID and ProductID
const options = {
	vendorID:  1234,
	productID: 5678
}
// Using path
const options = {
	path: 'IOService:/AppleACPI....'
}

const scanner = new UsbScanner(options)

Reading barcodes

scanner.on('data', (data) => {
	/// your code
	console.log(data);
});

scanner.startScanning()

Complete API

UsbScanner.showDevices()

  • Returns the devices connected to the computer.

scanner = new UsbScanner(options)

  • Creates and opens a new scanner using the options
    • vendorID - number - the vendorID of the device
    • productID - number - the productID of the device
    • path - string the path of the devices
    • vCardString - boolean - default: true - If true returns vCards as one string, instead of separate strings.
    • vCardSeperator string - default: '|' - If vCard string is true, this will be used as separation between the strings.

scanner.startScanning()

  • Starts listening for barcodes

scanner.stopScanning()

  • Stops listening for barcodes and closes the HID device.

scanner.on('data', functions(data) {})

  • listen for the data event to receive the barcode
  • data - a string containing the barcode as readable text from the scanner

node-usb-barcode-scanner-1's People

Contributors

dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.