Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 710 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 710 Bytes

simple-pcsc

A simple wrapper around santigimeno/node-pcsclite

Usage

'use strict';

const PCSC = require('simple-pcsc'); 
const nfc = new PCSC();
 
nfc.on('reader', reader => {
 
	console.log(`NFC (${reader.reader.name}): device attached`);
 
	reader.on('card', card => {
		console.log(`NFC (${reader.reader.name}): card detected`, card.uid); 
	});
 
	reader.on('error', err => { 
		console.log(`NFC (${reader.reader.name}): an error occurred`, err); 
	});
 
	reader.on('end', () => { 
		console.log(`NFC (${reader.reader.name}): device removed`); 
	}); 
});
 
nfc.on('error', err => { 
	console.log('NFC: an error occurred', err); 
});