# scuttler

> Automatic network communication

Latest version **0.1.3** (published 2013-10-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install scuttler
pnpm add scuttler
yarn add scuttler
bun add scuttler
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2013-10-16 |
| First published | 2013-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Michael Rhodes |
| Maintainers | michaelrhodes |
| Keywords | automatic, gossip, scuttlebutt |

## Links

- npm: https://www.npmjs.com/package/scuttler
- Repository: https://github.com/michaelrhodes/scuttler
- Issues: https://github.com/michaelrhodes/scuttler/issues
- npm.io page: https://npm.io/package/scuttler

## Dependencies (4)

- [arp-parse](https://npm.io/package/arp-parse.md) 0.0.2
- [arp-table](https://npm.io/package/arp-table.md) ~0.0.0
- [my-local-ip](https://npm.io/package/my-local-ip.md) ~1.0.0
- [scuttlebutt](https://npm.io/package/scuttlebutt.md) ~5.6.7

## Recent versions

- 0.1.3 (latest) — 2013-10-16
- 0.1.2 — 2013-10-12
- 0.1.1 — 2013-10-11
- 0.1.0 — 2013-10-11
- 0.0.1 — 2013-09-26
- 0.0.0 — 2013-09-26

## README

# scuttler
scuttler is a module that helps you write distributed, cross-platform network applications that automatically connect their users.

## Install
```
npm install scuttler
```

## API
``` js
// Specify a port for the internal TCP server.
var scuttler = new Scuttler(port)

// Send a message to all peers.
// String, Number, Object, and Array
// objects are all acceptable.
scuttler.write(message)

// Read the latest data from a given user.
// Note: The user argument is an IP address.
scuttler.read(user)

// Listen for messages from all peers.
scuttler.on('message', function(message, user) {})

// Listen for peer connection/disconnection.
scuttler.on('connect', function(user) {})
scuttler.on('disconnect', function(user) {})
```

### Example
This is a really basic (read: shitty) chat application, taken from the project’s example directory. Any computer on the network that runs the program will be automatically connected with everybody else. They’ll also be presented with the most recent messages of all of their peers.

``` js
var Scuttler = require('scuttler')
var scuttler = new Scuttler(process.argv[2])

process.stdin.on('data', function(data) {
  scuttler.write(data.toString())
})

scuttler.on('message', function(message, user) {
  if (user !== this.user)
    process.stdout.write(user + ': ' + message)
})

scuttler.on('connect', function(user) {
  process.stdout.write('-- ' + user + ' connected --\n')
})

scuttler.on('disconnect', function(user) {
  process.stdout.write('-- ' + user + ' disconnected --\n')
})
```

### No tests?
I love tests, but I’m not really sure *how* to write them for this module, seeing as it relies on communication with other computers. If you have any ideas, [get in touch](mailto:spam+scuttler@michaelrhod.es), but for what it’s worth, all the major dependencies have tests, and the example application runs without error on OS X, Linux, and Windows.

### License
[MIT](http://opensource.org/licenses/MIT)

---
_Source: https://npm.io/package/scuttler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
