NFC Smart Card Reader for Node.js on Windows (32 and 64 bit)
This module is equivalent to node-nfc but designed to work specifically on Windows, 32 and 64 bit where node-nfc fails due to driver issues.
npm install smartcardreader && node testCreates a new connection to a smart card reader. Optionally specify a reader name
var SmartCardReaderName = require('smartcardreader')('name of device');
var SmartCardReaderFirstFound = require('smartcardreader')();
Queries the first device name attached to Windows.
Returns: Device name on success, undefined on failure
Returns the name of all connected devices
Returns: Array of device names
- read emits data from the tag when a tag is successfully read
- connect when a connected device is found
- disconnect when a connected device is removed
var SmartCardReader = require('smartcardreader')();
SmartCardReader.on('connect', (device) => {
console.info(`connected: ${device}`);
});
SmartCardReader.on('disconnect', (device) => {
console.info(`disconnected: ${device}`);
});
SmartCardReader.on('read', (data) => {
console.info(`read: ${data}`);
});
Some readers register as multiple devices. To ensure connectivity is it advised that you specify the name of the expected device
Queries the first device name attached to Windows. This is an actual native query so caller is advised to cache the result.
Queries all device names attached to Windows. This is an actual native query so caller is advised to cache the result.
Returns: Array of device names on success, Empty array on failure or when no device is attached.
Polls data from the device. Caller should call this as often as possible to capture the data. Use of process.nextTick is advised.
Returns: An object { code: 123, data: "tag" }. Code is one of values listed here. Data is the data read from the Smart Card (if any).
Re-initializes internal resources and context associated with the reader object. Calls release internally. You may pass a device name or SmartCardReader::queryFirst will be used.
Returns: true if context is valid AND the device name passed is found and ready.
Releases internal resources and context associated with the reader object.
Returns: thin air (void, chaos).
