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 🙏

© 2024 – Pkg Stats / Ryan Hefner

enip-ts

v2.0.0

Published

Typescript implementation of the Ethernet/IP™ protocol.

Downloads

199

Readme

ts-enip – TypeScript EtherNet/IP™

🚀 Build package and publish to npm npm

TypeScript implementation of the Ethernet/IP™ protocol. This implementation is less complete.

Based on the work of cmseaton42/node-ethernet-ip and SerafinTech/ST-node-ethernet-ip.

Contributions

Contributions will be highly appreciated 👍. This package use changesets for its versioning. Create a Changeset using

npx changeset
pnpm exec changeset

Sepcify what have changed, commit to your branch and create a pull request on this repo 📝. Changeset bot will detect changesets.

Building

Run PNPM to build this package.

npm run build
pnpm run build

Installing

Install this package with

npm install enip-ts
pnpm install enip-ts

Using the library

Client Side

import { ENIP } from "ts-enip";

const enip = new ENIP.SocketController();

const sessionID = await enip.connect("127.0.0.1");

if(sessionID)
{
    /**
     * Define your ethernet ip packet here
     * You can used bundled tools like Encapsulation.CPF
     */ 

    //Path for ethernet ip protocol
    const idPath = Buffer.from([0x20, 0x04, 0x24, 0x96, 0x30, 0x03]);
    
    //Message router packet
    const MR = MessageRouter.build(0x0E, idPath, Buffer.alloc(0));

    enip.write(MR, false, 10);
}

Server side

For server side, only services 0x0E & 0x10 are supported.


    const actualData = Buffer.alloc(4, 0xF0);
    
    const vector: ENIPDataVector = {
        0x0E: (data) => {
            if(data.path.class == 4 && data.path.instance == 150 && data.path.attribute == 3)
                return actualData;
            else
                return;
        },
        0x10: (data) => {
            if(data.path.class == 4 && data.path.instance == 150 && data.path.attribute == 3 && data.data)
            {
                data.data.copy(actualData);
                return actualData;
            }
            else
                return;
        }
    }
    
    const server = new ENIPServer(vector);
    
    // Server will listen on Default enip port 44818
    server.listen();