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

ih-lib60870-node

v1.0.71

Published

Cross-platform Node.js native addon of the iec60870 support

Readme

ih-lib60870-node

A cross-platform Node.js native addon for the IEC 60870-5 protocol suite, enabling seamless communication with industrial control systems, SCADA, and RTUs. Built with node-gyp and prebuild, this addon ensures compatibility across multiple operating systems and architectures.


✨ Features

  • IEC 60870-5 Protocol Support: Implements key functionalities of IEC 60870-5 standards (e.g., IEC 60870-5-101/104) for robust industrial automation communication.
  • Cross-Platform Compatibility: Supports Windows, Linux, and macOS with prebuilt binaries for x64, arm, and arm64 architectures.
  • High Performance: Native C++ implementation optimized for low-latency and reliable data exchange.
  • File Transfer: Supports file transfer operations in both monitoring and control directions.
  • Flexible Integration: Easy-to-use APIs for integration with Node.js applications, SCADA systems, or custom control solutions.
  • Prebuilt Binaries: Includes precompiled binaries for Node.js v20, simplifying setup and deployment.

🖥️ Supported Platforms

| Operating System | Architectures | |------------------|--------------------| | Windows | x64 | | Linux | x64, arm, arm64 | | macOS | x64, arm64 |


🚀 Installation

  1. Ensure you have Node.js v20 installed.

  2. Install the package via npm:

    npm install ih-lib60870-node --ignore-scripts
  3. Prebuilt binaries will be automatically downloaded for your platform and architecture. If a prebuilt binary is unavailable, the addon will be compiled using node-gyp, requiring:

    • Python 3.11+
    • A compatible C++ compiler:
      • gcc on Linux
      • MSVC on Windows
      • clang on macOS

📖 Usage

Below is an example of using ih-lib60870-node to establish an IEC 60870-5-104 connection and handle data:

const { IEC104Client } = require('ih-lib60870-node');
const util = require('util');
const fs = require('fs');

// Initialize an IEC 60870-5-104 client
const client = new IEC104Client((event, data) => {
    if (data.event === 'opened') client.sendStartDT();
    console.log(`Server 1 Event: ${event}, Data: ${util.inspect(data)}`);
    if (data.event === 'activated') client.sendCommands([
        { typeId: 100, ioa: 0, asdu: 1, value: 20 },          // Interrogation command
        { typeId: 45, ioa: 145, value: true, asdu: 1, bselCmd: true, ql: 1 },  // C_SC_NA_1: On
        { typeId: 46, ioa: 4000, value: 1, asdu: 1, bselCmd: 1, ql: 2 },      // C_DC_NA_1: Off
        { typeId: 47, ioa: 147, value: 1, asdu: 1, bselCmd: 1, ql: 0 },       // C_RC_NA_1: Increase
        { typeId: 48, ioa: 148, value: 0.001, asdu: 1, selCmd: 1, ql: 0 },    // C_SE_NA_1: Normalized setpoint
        { typeId: 49, ioa: 149, value: 5000, asdu: 1, bselCmd: 1, ql: 0 },    // C_SE_NB_1: Scaled setpoint
        { typeId: 50, ioa: 150, value: 123.45, asdu: 1 },                     // C_SE_NC_1: Floating point setpoint
    ]);
});

const client2 = new IEC104Client((event, data) => {
    if (data.event === 'opened') client2.sendStartDT();
    console.log(`Server 2 Event: ${event}, Data: ${util.inspect(data)}`);
});

async function main() {
    const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));

    client.connect({
        ip: "192.168.0.1",
        port: 2404,
        clientID: "client1",
        ipReserve: "192.168.0.2",
        reconnectDelay: 2,           // Reconnection delay in seconds
        originatorAddress: 0,
        asduAddress: 1,
        k: 12,
        w: 8,
        t0: 30,
        t1: 15,
        t2: 10,
        t3: 20,
        maxRetries: 5
    });

    client2.connect({
        ip: "192.168.0.10",
        port: 2404,
        clientID: "client2",
        originatorAddress: 1,
        k: 12,
        w: 8,
        t0: 30,
        t1: 15,
        t2: 10,
        t3: 20,
        reconnectDelay: 2,
        maxRetries: 5
    });

    // Wait for synchronization (optional)
    await sleep(1000);
}

main();

📚 Additional Examples: Examples for each supported protocol (e.g., IEC 60870-5-101, IEC 60870-5-104) are available in the examples/ directory. These demonstrate various configurations and use cases for industrial automation.


🛠️ Building from Source

To build the addon from source:

  1. Clone the repository:

    git clone https://github.com/intrahouseio/ih-lib60870-node.git
    cd ih-lib60870-node
  2. Install dependencies:

    npm install
  3. Configure and build:

    npm run configure
    npm run build
  4. Optionally, generate prebuilt binaries:

    npm run prebuild

🤝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Submit a pull request with a clear description of your changes.

📜 License

This project is licensed under the MIT License.


💬 Support

For issues, questions, or feature requests, please open an issue on the GitHub repository.