Skip to content

This is an unofficial library that allows Node.js developers to easily interface with ZK BioMetric Fingerprint Attendance Devices, extract and manage data, and integrate biometric features into attendance systems efficiently. Resources

License

Notifications You must be signed in to change notification settings

guspaz0/zklib-ts

 
 

Repository files navigation

NPM

zklib ts

An unofficial library that provides a robust solution for Node.js developers to interface with ZKTeco Devices.

Warning

This repository is currently in development and may contain bugs or incomplete features. Use at your own risk and do not deploy to a production environment

📋 Index

  1. Installation
  2. ⚙️ Usage
  3. 🛠️ Testing
  4. 🗄️Alternatives
  5. 📄 Documentation

Installation

You must have Node.js ^18 before run the command down below:

npm i zklib-ts

🛠️ Usage

create a connection. constructor receives (ip, timeout, inport, port, comm_key)

import Zklib from 'zklib-ts'

const zkInstance = new Zklib("10.0.0.10",10000,10000,4370,0)

await zkInstance.createSocket()

Get all users:

const users = await zkInstance.getUsers()

Get all attendances:

const attendances = await zkInstance.getAttendances()

get All templates

const templates = await zkInstance.getTemplates() 

save user templates. receives a User instance class and an array of Finger class. currently only save one template per call.

const templates = await zkInstance.saveUserTemplate(user, templates) 

enrollUser: receives a user user_id and finger ID fid where 0 <= fid <= 9

await zkInstance.enrollUser(50,5)

delete template. receives user id uid and finger id where 0 <= fid <= 9

await zkInstance.deleteTemplate(50,5)

Check the Testing section for more functionalities coverage.

🛠️ Testing

The repo uses Jest. There is a mock file for test without having a phisical device connected. Before start you will need to install dependencies.

npm i

for testing your phisical device first create .env file in root directory with the values down below:

DEVICE_IP=10.10.10.1
DEVICE_PORT=4370
DEVICE_PASSWORD=1234

and then run tests:

npm t

for testing especific file after "npm t" type some name that matches a test file ... for example the next command will execute "Generic.test.ts"

npm t Generic

🗄️ Alternatives

Javascript

Python:

☕ Java:

📄 Documentation

License

The MIT License (MIT). Please see License File for more information.

About

This is an unofficial library that allows Node.js developers to easily interface with ZK BioMetric Fingerprint Attendance Devices, extract and manage data, and integrate biometric features into attendance systems efficiently. Resources

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.4%
  • JavaScript 0.6%