npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@palmcode/zkteco-iclock-parser

v0.0.4

Published

A TypeScript/JavaScript parser for ZKTeco iClock protocol attendance data with type safety and comprehensive error handling

Downloads

26

Readme

🔐 ZKTeco iClock Parser

A robust TypeScript/JavaScript parser for ZKTeco iClock protocol attendance data with perfect type safety and comprehensive error handling.

npm version npm downloads license: MIT

✨ Features

  • 🎯 Perfect Type Safety - Complete TypeScript definitions
  • 🛡️ Robust Error Handling - Graceful parsing with warnings
  • 🔍 Comprehensive Support - All verification types (Fingerprint, Face, Palm, Card, Password)
  • 📊 Device Info Parsing - Parse device information from requests
  • High Performance - Optimized for real-time attendance processing
  • 🌐 Framework Agnostic - Works with Node.js, Bun, Express, etc.

🚀 Quick Start

Installation

npm install @palmcode/zkteco-iclock-parser

Basic Usage

const { ZKTecoiClockParser } = require('@palmcode/zkteco-iclock-parser');

// Parse attendance data from ZKTeco device
const attendanceData = '11\t2025-08-27 10:57:49\t0\t25\t0\t0\t0\t0\t0\t0';
const result = ZKTecoiClockParser.parseAttendanceLog(attendanceData);

if (result.success) {
  result.data.forEach(log => {
    console.log(`User ${log.userID} - ${log.timestamp}`);
    console.log(`Type: ${ZKTecoiClockParser.getVerifyTypeName(log.verifyType)}`);
    console.log(`Action: ${ZKTecoiClockParser.isCheckIn(log) ? 'Check In' : 'Check Out'}`);
  });
}

TypeScript Usage

import { ZKTecoiClockParser, AttendanceLog, VerifyType } from '@palmcode/zkteco-iclock-parser';

const result = ZKTecoiClockParser.parseAttendanceLog(data);

if (result.success && result.data) {
  result.data.forEach((log: AttendanceLog) => {
    if (log.verifyType === VerifyType.PALM) {
      console.log('Palm recognition used!');
    }
  });
}

📋 API Reference

parseAttendanceLog(data: string, options?: ParserOptions)

Parse raw attendance data from ZKTeco device.

Parameters:

  • data - Raw tab-separated attendance data
  • options - Parser options (optional)

Returns: ParseResult<AttendanceLog[]>

parseDeviceInfo(queryParams: Record<string, string>)

Parse device information from HTTP query parameters.

Returns: ParseResult<DeviceInfo>

Utility Methods

  • isCheckIn(log: AttendanceLog): boolean
  • isCheckOut(log: AttendanceLog): boolean
  • getVerifyTypeName(type: VerifyType): string
  • formatAttendanceLog(log: AttendanceLog): string

🔧 Server Integration Examples

Bun Server

import { ZKTecoiClockParser } from '@palmcode/zkteco-iclock-parser';

Bun.serve({
  port: 3010,
  async fetch(req) {
    if (req.url.includes('/iclock/cdata')) {
      const body = await req.text();
      const result = ZKTecoiClockParser.parseAttendanceLog(body);
      
      // Process attendance logs
      
      return new Response("OK");
    }
  }
});

Express.js Server

const express = require('express');
const { ZKTecoiClockParser } = require('@palmcode/zkteco-iclock-parser');

const app = express();
app.use(express.text());

app.post('/iclock/cdata', (req, res) => {
  const result = ZKTecoiClockParser.parseAttendanceLog(req.body);
  
  if (result.success) {
    // Process attendance data
    result.data.forEach(log => {
      console.log(ZKTecoiClockParser.formatAttendanceLog(log));
    });
  }
  
  res.send('OK');
});

app.listen(3010);

📊 Data Format

Attendance Log Structure

| Field | Position | Description | |-------|----------|-------------| | UserID | 0 | Employee/User identifier | | Timestamp | 1 | Date and time (YYYY-MM-DD HH:mm:ss) | | InOutMode | 2 | 0=Check In, 1=Check Out, 2=Break Out, etc. | | VerifyType | 3 | 1=Fingerprint, 15=Face, 25=Palm, etc. | | WorkCode | 4 | 0=Normal, 1=Overtime, 2=Holiday, etc. |

🎯 Verification Types

  • FINGERPRINT (1) - Fingerprint verification
  • PASSWORD (2) - Password verification
  • CARD (3) - Card/RFID verification
  • FACE (15) - Face recognition
  • PALM (25) - Palm recognition

🔄 In/Out Modes

  • CHECK_IN (0) - Regular check-in
  • CHECK_OUT (1) - Regular check-out
  • BREAK_OUT (2) - Break time start
  • BREAK_IN (3) - Break time end
  • OT_IN (4) - Overtime start
  • OT_OUT (5) - Overtime end

🛠️ Advanced Options

const options = {
  strictMode: true,        // Fail on any parsing error
  includeRawData: true,   // Include raw line in result
  timestampFormat: 'auto' // Timestamp parsing mode
};

const result = ZKTecoiClockParser.parseAttendanceLog(data, options);

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT © Palm Code Software Development L.L.C