snake-pipe-node
A partial node implementation of my rust cli topheman/snake-pipe-rust.
Prerequisites
Install
npm install -g snakepipe
Optional: Install the rust version - it will let you pipe original commands
cargo install snakepipe
Usage
This is a partial implementation, for all the commands, see the rust implementation.
Piping
📎 Validate incomming stream
snakepipe gamestate|snakepipenode validate
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.
snakepipe gamestate|snakepipenode tcp-play|snakepipe render
nc localhost 8050|snakepipe render
snakepipenode tcp-watch|snakepipe render
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.
snakepipe gamestate|snakepipenode socket-play|snakepipe render
nc -U /tmp/snakepipe.sock|snakepipe render
snakepipenode socket-watch|snakepipe render
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