zklib-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.3-development • Public • Published

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.

Package Sidebar

Install

npm i zklib-ts

Weekly Downloads

7

Version

1.0.3-development

License

MIT

Unpacked Size

250 kB

Total Files

16

Last publish

Collaborators

  • guspaz0