Node.js library for reading Thai national ID cards using PC/SC smart card readers.
npm install thai-id-reader!License
!Node.js >=16
!Platform
A Node.js library for reading Thai national ID cards using a PC/SC smart card reader.
Returns parsed data in clean JSON format with name, gender, address, and more.
- 🇹🇭 thai-id-reader
- Table of Contents
- Installation
- Usage
- Sample Output
- Features
- License
---
``bash`
npm install thai-id-reader
Requires pcsclite-compatible smart card reader and driver installed.
`js
const { readThaiIdCard } = require("thai-id-reader");
readThaiIdCard()
.then((data) => {
console.log("✅ Thai ID Card Data:", data);
})
.catch((err) => {
console.error("❌ Failed to read card:", err.message);
});
`
json
{
"cid": "1234567890123",
"fullNameThai": {
"title": "นาย",
"firstname": "สมชาย",
"lastname": "ใจดี"
},
"fullNameEng": {
"title": "Mr.",
"firstname": "Somchai",
"lastname": "Jaidee"
},
"gender": "ชาย",
"birthDate": "01 Jan 2540",
"issueDate": "15 Mar 2565",
"expiryDate": "15 Mar 2575",
"address": {
"houseNo": "99/1",
"moo": "5",
"soi": "สุขสบาย 10",
"road": "พหลโยธิน",
"subDistrict": "ลาดยาว",
"district": "จตุจักร",
"province": "กรุงเทพมหานคร",
"postcode": "10900"
}
}
``- ✅ Read Thai citizen ID card via Smart Card Reader
- ✅ Decode TIS-620 Thai characters
- ✅ Auto-format address & split full name
- ✅ Automatic postal code lookup from Excel dataset
- ✅ Supports Windows, macOS, Linux (with PC/SC)