Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snakepipe

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snakepipe

A node implementation of the rust snakepipe crate

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

snake-pipe-node

npm

A partial node implementation of my rust cli topheman/snake-pipe-rust.

Prerequisites

  • Node

Install

npm install -g snakepipe # will install snakepipenode

Optional: Install the rust version - it will let you pipe original commands

cargo install snakepipe # will install snakepipe

Usage

This is a partial implementation, for all the commands, see the rust implementation.

Piping

📎 Validate incomming stream
# Without piping to render
snakepipe gamestate|snakepipenode validate

# Piping to render
snakepipe gamestate|snakepipenode validate|snakepipe render

IPC (Inter-process communication)

This node version ships with an implementation of IPS supporting tcp and unix domain sockets, just like in the rust version,

TCP

Open two terminals. snakepipenode tcp-play will expose a process that accepts tcp connections (on port 8050 by default). You can connect to it via netcat (the nc command), that will pipe the tcp stream output to stdout.

Here are a few commands mixing the rust and node versions.

# main terminal
snakepipe gamestate|snakepipenode tcp-play|snakepipe render
# mirroring terminal
nc localhost 8050|snakepipe render # with netcat
snakepipenode tcp-watch|snakepipe render # or with snakepipe itself
Unix domain sockets

Open two terminals. snakepipenode socket-play will expose a unix domain socket (by default on /tmp/snakepipe.sock). You can connect to it via netcat (the nc command), that will pipe the socket stream to stdout.

# main terminal
snakepipe gamestate|snakepipenode socket-play|snakepipe render
# mirroring terminal
nc -U /tmp/snakepipe.sock|snakepipe render # with netcat
snakepipenode socket-watch|snakepipe render # or with snakepipe itself

Usage as a library

npm install snakepipe

See example of usage on topheman/snake-pipe-rust.

Known bugs

  • tty issue when piping from snakepipe gamestate #1

Keywords

FAQs

Package last updated on 29 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc