I do not use IOT XDK, but there are chances that your Barcode scanner register itself as a keyboard under Linux.
See this SO thread to know how to read stdin with node.js
Maybe there is some information here for you too:
@speccy88 thanks for your suggestion. I already have the app working from process.stdin on my laptop. The problem is that a keyboard connected to the USB host bus on the Edison, or in this case a barcode scanner that behaves as a keyboard, doesn't get mapped to stdin when running headless.
I thought I could go straight to the USB device, but the older version of node-usb didn't work with the scanner, and the newer version from the git repo nonolith/node-usb · GitHub that works on the laptop won't build from package.json/npm install.
I just found this :
Maybe you could redirect a stream to your program:
./program < /dev/tty1
or maybe read from it directly with something like this :
var t = new tty.ReadStream(fs.openSync('/dev/tty1', 'r'))
I bet that your scanner is attached to one of these tty character device
Did you manage to get the barcode scanner working?
I was eventually able to get it to work with node-hid, but I had to fiddle around with dependencies and run the npm install from shell on the device. It doesnt work with the IOT tooling.