# iaunn-card-reader

> This package is used to read personal information from thai national id cards. - tested on node v.16.17.0 - tested on macOS Monterey v.12.5.1 - tested on windows 11 v.21H2 - maybe work on linux. didn't test

Latest version **1.0.53** (published 2023-10-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install iaunn-card-reader
pnpm add iaunn-card-reader
yarn add iaunn-card-reader
bun add iaunn-card-reader
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.53 |
| Published | 2023-10-06 |
| First published | 2023-10-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 47.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | iaunn |
| Keywords | thai smart card reader, smart card, thai national id card |

## Links

- npm: https://www.npmjs.com/package/iaunn-card-reader
- npm.io page: https://npm.io/package/iaunn-card-reader

## Dependencies (7)

- [axios](https://npm.io/package/axios.md) ^1.1.3
- [moment](https://npm.io/package/moment.md) ^2.29.4
- [datauri](https://npm.io/package/datauri.md) ^4.1.0
- [encoding](https://npm.io/package/encoding.md) ^0.1.13
- [pcsclite](https://npm.io/package/pcsclite.md) ^1.0.1
- [eventemitter3](https://npm.io/package/eventemitter3.md) ^4.0.7
- [legacy-encoding](https://npm.io/package/legacy-encoding.md) ^3.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.53 (latest) — 2023-10-06
- 1.0.52 — 2023-10-05
- 1.0.51 — 2023-10-05
- 1.0.50 — 2023-10-05

## README

# Thai ID Card Reader

This package is used to read personal information from thai national id cards.
- tested on node v.16.17.0
- tested on macOS Monterey v.12.5.1
- tested on windows 11 v.21H2
- maybe work on linux. didn't test


![Alt Text](https://github.com/goomgumx/thai-id-card-reader/blob/main/demo.gif?raw=true)

### Install
```
npm i thai-id-card-reader
```

on windows : if you got error. you must to install window build tool first
```
npm install --global windows-build-tools@4.0.0
```
on windows : if you still got error. you must to install visual studio minimum version 2019 following link below 
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

install following this answer on stackoverflow
https://stackoverflow.com/a/54136652/16455947


### Example code
```
import ThaiIDCardReader from "thai-id-card-reader"

const reader = new ThaiIDCardReader()
reader.init()
// macOS set to 0, windows set to 1000
reader.setInsertCardDelay(1000) 
// if run on macOS you can remove function setReadTimeout below
// if you run on windows and it stuck. didn't get any data. try to increase timeout value
reader.setReadTimeout(1) 
reader.onReadComplete((data) => {
  console.log(data)
})
reader.onReadError((error) => {
  console.log(error)
})

```

### Response object 
| keyName | type |  
| --- | --- |
| citizenID    | string |
| fullNameTH | string |
| fullNameEN | string |
| titleTH | string |
| titleEN | string |
| firstNameTH | string |
| firstNameEN | string |
| lastNameTH | string |
| lastNameEN | string |
| gender | string ('male' or 'female') |
| dateOfBirth | string (YYYY-MM-DD)|
| address | string |
| cardIssuer | string |
| issueDate | string (YYYY-MM-DD)|
| expireDate | string (YYYY-MM-DD)|
| photoAsBase64Uri | string |

---
_Source: https://npm.io/package/iaunn-card-reader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
