npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@iqrok/pcsclite.helper

v0.1.1

Published

wrapper for pcsclite package

Downloads

10

Readme

pcsclite Helper

this package is only a wrapper for pcsclite. Only tested on Ubuntu/Debian using ACR122U and MIFARE 1K card.

Prerequisites

You must install these packages first

sudo apt install libpcsclite1 libpcsclite-dev pcscd libacsccid1

NOTE: libacsccid1 is required for ACR122U reader

these kernel modules must be removed in order to make pcsc reader detected:

# remove kernel modules temporarily
sudo rmmod pn533_usb pn533 nfc

# block kernel modules permanently
echo "install nfc /bin/false" | sudo tee -a /etc/modprobe.d/blacklist.conf
echo "install pn533 /bin/false" | sudo tee -a /etc/modprobe.d/blacklist.conf
echo "install pn533_usb /bin/false" | sudo tee -a /etc/modprobe.d/blacklist.conf

You can execute enablepcsc.sh, included in this repository, to simplify the steps above.

Installation

npm install @iqrok/pcsclite.helper

Example

const RFID = require('@iqrok/pcsclite.helper');

// check if pcscd is available or not
if(!RFID){
	console.error('pcscd service is not running!', RFID);
	return;
}

(async () => {
	await RFID.setTimeout(0xff);

	RFID.on('reader', received => {
		console.log('reader', received);
	});

	RFID.on('status', received => {
		console.log('status', received);
	});

	RFID.on('error', received => {
		console.log('error', received);
	});

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

	RFID.on('blocks', received => {
		console.log('blocks', received);
	});

	RFID.on('removed', received => {
		console.log('card removed', received);
	});

	RFID.on('uid', received => {
		console.log('card uid', received);
	});

	RFID.on('ready', async protocol => {
		const obj = {
			id: '12345678',
			time: Date.now(),
		};

		const input = JSON.stringify(obj);
		const block = 4;

		const write = await RFID.writeBlocks(input, block);

		const read = [
			await RFID.readBlocks(block),
			await RFID.readBlocksString(block),
			await RFID.readBlocksJSON(block),
		];

		const status = await RFID.status(block);

		console.log('--------- Data Written ---------');
		console.log('Input :', input);
		console.log('Write :', write);
		console.log('--------- Data Read ---------');
		console.log('RAW', read[0]);
		console.log('STRING', read[1]);
		console.log('JSON', read[2]);
		console.log('--------- ---- ---- ---------');
	});
})();

Events

|Event Name|Triggered on| |---|---| |reader|reader status is changed| |status|reader connection status is changed| |card-status|request RFID card status| |error|there's error in reader or card action| |data|incoming data from RFID card| |blocks|incoming data after reading multiple blocks| |ready|RFID card is connected to reader| |removed|RFID card is removed from reader| |uid|RFID card uid|