node_pepper

broadcasts the results of an executed command over the local network

Usage no npm install needed!

<script type="module">
  import nodePepper from 'https://cdn.skypack.dev/node_pepper';
</script>

README

node_pepper

Descripton

Executes a command and sends broadcast the results over the local IPv4 network.

Example 1

Minimal working example:

Send uptime result to default address 255.255.255.255 and port 8888.

const pepper = require('node_pepper');

pepper('uptime')

Example 2

Send results of your command line arguments. Here we specify the optional parameters:

  • broadcast address 192.1680.255
  • port 8889
  • prefixing the result with [sender_hostname]:
const pepper = require('node_pepper');
const os = require("os");

const args = process.argv.slice(2);
const cmd = args[0] || 'uptime';
const param = args.slice(1);

const resultPrefix = os.hostname() + ":";

pepper(cmd, param, '192.168.0.255', 8889, resultPrefix)

Receiving

Use node_sniffandsneeze to sniff the pepper and sneeze these results somewhere else.

Change log

replace prefix by pre-process callback, default return same