2.0.5 • Published 1 year ago

zk-jubaer v2.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

npm i zk-jubaer

Or, if you prefer Yarn:

yarn add zk-jubaer

Usage Example

const ZKJUBAER = require("zk-jubaer");

const runMachine = async () => {
  let obj = new ZKJUBAER("192.168.1.106", 4370, 5200, 5000);
  try {
    // Create socket to machine
    await obj.createSocket();

    // Get all logs in the machine
    const logs = await obj.getAttendances();
    console.log(logs);

    // Read real-time logs
    await obj.getRealTimeLogs((data) => {
      console.log(data);
    });

    // Disconnect from device
    await obj.disconnect(); // when you are using real-time logs, you need to disconnect manually
  } catch (e) {
    console.log(e);
  }
};

runMachine();

API Reference :

  • createSocket() - creates a connection to the device
  • getInfo() - returns general information about the device, such as log capacity and user count
  • getUsers()- returns an array of all users in the device
  • setUser(uid, userid, name, password, role = 0, cardno = 0) - adds a new user to the device
  • getAttendances() - returns an array of all attendance logs in the device
  • getRealTimeLogs(callback) - sets up a real-time log stream and calls the provided callback function with each new log
  • getPIN() - returns the device PIN

  • getFaceOn() - returns the device Face On status

  • getSSR() - returns the device Self-Service-Recorder (SSR) status
  • getDeviceVersion() - returns the device version
  • getDeviceName() - returns the device name
  • getPlatform() - returns the device platform version
  • getOS() - returns the device OS version
  • getAttendanceSize() - returns the device attendance size
  • clearAttendanceLog() - clears the attendance log
  • disconnect() - disconnects from the device

Don't forget to star the repo if you like it.