zkmafuz
v1.0.6
Published
TCP-based ZKTeco fingerprint device Node.js TypeScript library. Created by Mafuz(mafuz.dev).
Downloads
122
Maintainers
Readme
zkmafuz
🚀 TCP-based ZKTeco Fingerprint Device Library for Node.js & TypeScript
zkmafuz is a lightweight Node.js library written in TypeScript that allows you to communicate with ZKTeco fingerprint devices using TCP.
It is designed for backend usage (Fastify, Express, NestJS, etc.) to fetch attendance logs and manage device data.
✨ Features
- ✅ Connect to ZKTeco fingerprint devices via TCP
- 📥 Fetch attendance logs
- 🧹 Clear attendance logs from device
- 🧠 Written in TypeScript with typings
- ⚡ Lightweight & fast
- 🔌 Works with Fastify / Express / Node.js backends
📦 Installation
npm install zkmafuz
## ⚙️ Step-by-Step Usage
# Import the Library
import { ZKMafuzDevice } from "zkmafuz";
# Configure the Device
const deviceConfig = {
ip: "device_ip", // Device IP address
port: device_port, // Default ZKTeco TCP port
timeout: 10000 // Connection timeout in milliseconds
};
# Create a Device Instance
const device = new ZKMafuzDevice(deviceConfig);
# Fetch Attendance Logs
(async () => {
try {
const logs = await device.fetchAttendanceLogs();
console.log("Attendance Logs:", logs);
} catch (error) {
console.error("Error connecting to device:", error);
}
})();
# Clear Attendance Logs
(async () => {
try {
await device.clearLogs();
console.log("All logs cleared successfully");
} catch (error) {
console.error("Error clearing logs:", error);
}
})();