# pull-handshake

> easily create a duplex protocol that starts with a handshake

Latest version **1.1.4** (published 2016-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install pull-handshake
pnpm add pull-handshake
yarn add pull-handshake
bun add pull-handshake
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2016-08-05 |
| First published | 2014-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Dominic Tarr |
| Maintainers | dominictarr |

## Links

- npm: https://www.npmjs.com/package/pull-handshake
- Repository: https://github.com/dominictarr/pull-handshake
- Issues: https://github.com/dominictarr/pull-handshake/issues
- npm.io page: https://npm.io/package/pull-handshake

## Dependencies (4)

- [pull-cat](https://npm.io/package/pull-cat.md) ^1.1.9
- [pull-pair](https://npm.io/package/pull-pair.md) ~1.1.0
- [pull-reader](https://npm.io/package/pull-reader.md) ^1.2.3
- [pull-pushable](https://npm.io/package/pull-pushable.md) ^2.0.0

## Recent versions

- 1.1.4 (latest) — 2016-08-05
- 1.1.3 — 2016-06-13
- 1.1.2 — 2016-04-06
- 1.1.1 — 2016-03-15
- 1.1.0 — 2016-03-15
- 1.0.4 — 2015-09-17
- 1.0.2 — 2015-07-03
- 1.0.1 — 2015-06-17
- 1.0.0 — 2015-06-17
- 0.0.2 — 2014-05-11
- 0.0.1 — 2014-04-03
- 0.0.0 — 2014-04-02

## README

# pull-handshake

Create handshakes for binary protocols with pull streams.

# Example

``` js
var stream = handshake()
var shake = stream.handshake

// Pull some amount of data out of the stream
shake.read(32, function (err, data) {

  // Write a response...
  shake.write(new Buffer('hello there'))

  shake.read(32, function (err, data) {
    // Get a confirmation,
    // and then attach the application
    var stream = createApplicationStream()

    pull(stream, shake.rest(), stream)
    // shake.rest() returns a duplex binary stream.
  })
})


// shake is itself a duplex pull-stream.
pull(shake, stream, shake)
```

## API

### `handshake([opts], [callback])`

#### opts

Type: `Object`<br>
Default: `{timeout: 5e3}`

The allowed duration for the handshake to take place.

#### callback

Type: `Function`<br>
Default: `function noop () {}`

This will be called when the handshake completes, or fails. In the case of failure it is called with an `error`.

## License

MIT

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