Socket
Socket
Sign inDemoInstall

olp-usb-barcode-scanner

Package Overview
Dependencies
76
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    olp-usb-barcode-scanner

A typed library for using USB barcode scanners in Node.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Typed usb-barcode scanner

A typed library for using USB barcode scanners in Node.js with support for Typescript.

On Linux and Mac, you have to run your application with root privileges.

Intallation

You can install this package by running the following command:

npm i usb-barcode-scanner --save

Or using yarn:

yarn add usb-barcode-scanner

Usage Typescript

You can list all devices using the following code:

import { getDevices } from 'usb-barcode-scanner';

console.log(getDevices());
import { UsbScanner } from 'usb-barcode-scanner';

let scanner = new UsbScanner({
    vendorId: 1155,
    productId: 22352
    /** You could also initialize the scanner by giving entering the path variable:
     *  path: 'IOService:/AppleACPI etc...'
    **/  
});

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

scanner.startScanning();

To stop scanning, you can use:

scanner.stopScanning();

Usage Vanilla JS

You can list all devices using the following code:

let getDevices = require('usb-barcode-scanner').getDevices;

console.log(getDevices());
let UsbScanner = require('usb-barcode-scanner').UsbScanner;

let scanner = new UsbScanner({
    vendorId: 1155,
    productId: 22352
});

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

scanner.startScanning();

To stop scanning, you can use:

scanner.stopScanning();

Keywords

FAQs

Last updated on 10 Sep 2019

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