# peers

> peer2peer nodejs applications

Latest version **0.1.0** (published 2012-09-11) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2012-09-11 |
| First published | 2012-09-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Dominic Tarr |
| Maintainers | dominictarr |

## Links

- npm: https://www.npmjs.com/package/peers
- Repository: https://github.com/dominictarr/peers
- Homepage: http://github.com/dominictarr/peers
- npm.io page: https://npm.io/package/peers

## Dependencies (6)

- [crdt](https://npm.io/package/crdt.md) ~3.0.0
- [through](https://npm.io/package/through.md) ~0.1.4
- [optimist](https://npm.io/package/optimist.md) ~0.3.4
- [mux-demux](https://npm.io/package/mux-demux.md) ~3.3.2
- [node-uuid](https://npm.io/package/node-uuid.md) ~1.3.3
- [event-stream](https://npm.io/package/event-stream.md) ~3.0.4

## Recent versions

- 0.1.0 (latest) — 2012-09-11

## README

#peers

a simple peer-to-peer framework.

replicate dynamic data through a trusted network with a gossip protocol and [crdt](http://github.com/dominictarr/crdt)

## Usage

``` js

peers()
  .use(function name (stream, other) {
    //plugin style, can stream to other side.
  })
  .connect(initial_port, initial_host)
  .connect(initial_port2)   //.. as many as you like...
  .listen(port, host)       //port to listen on.

```

peers needs to know a it's id, a file where it can persist it's data, 
an address to listen on, and an initial address to connect to.

the first time you run a peer, pass these as options.

``` sh

./cli.js --id TEST1 --file ./TEST1.crdt --host localhost:4000
```
the peer will persist this information about it self, and the second time you run a peer
you only need to pass the file

``` sh
./cli.js --file ./TEST1.crdt
```

once you have one peer running, tell another to connect to it!

``` sh

./cli.js --id TEST2 --file ./TEST2.crdt --host localhost:4001 --init 4000

```

you only need to introduce a peer the first time, once it's connected to the network,
it will learn about other peers, and it will connect to them next time.
although, if their addresses have all changed, then you will need to introduce it again.

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