I'm developing an desktop application using node-webkit(nw.js) i want to integrate real barcode scanner with that app for merchants how can i integrate real barcode scanner with node.js
3 Answers
I know this is kinda late but I just made this module to read data with barcode scanners without depending on browser or window and it works even if the cursor is not placed anywhere, since it use native key events from the system.
For install and documentation: native-barcode-scanner
This is a simple example of how to use it:
import BarcodeScanner from "native-barcode-scanner";
const options = {}
const scanner = new BarcodeScanner(options);
scanner.on('code', code => {
console.log(code);
});
// Remove the listener
scanner.off();
And you can even scope instances per device, if you use multiple barcode scanners in a same system.
I place it here for anyone that needs it on the future.
Hope it helps :D (excuse my english).

- 176
- 1
- 7
First you'll need to figure out what kind of interface the scanner uses to communicate with the PC, then if you're lucky you might be able to find an existing NPM package that can handle the communication with the scanner.

- 14,463
- 2
- 52
- 45
It is hard to say anything without the hardware specification, but I think, it is easier than you think. The most barcode scanner is a simple keyboard input. Simpli just enter scanned bar code data into any application as if the data was being keyed in by the user. Just scan a bar code and the data will appear wherever the cursor is placed.
So you don't need to worry about it, just handle keyboard events.

- 2,190
- 22
- 24