# it-handshake

> Create handshakes for binary protocols with iterable streams

Latest version **4.1.3** (published 2023-04-18) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.1.3 |
| Published | 2023-04-18 |
| First published | 2019-09-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=16.0.0 |
| Dependencies | 5 |
| Unpacked size | 26.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Jacob Heun |
| Maintainers | jacobheun |
| Keywords | async, handshake, iterable, iterator |

## Links

- npm: https://www.npmjs.com/package/it-handshake
- Repository: https://github.com/jacobheun/it-handshake
- Homepage: https://github.com/jacobheun/it-handshake#readme
- Issues: https://github.com/jacobheun/it-handshake/issues
- npm.io page: https://npm.io/package/it-handshake

## Dependencies (5)

- [p-defer](https://npm.io/package/p-defer.md) ^4.0.0
- [it-reader](https://npm.io/package/it-reader.md) ^6.0.1
- [it-pushable](https://npm.io/package/it-pushable.md) ^3.1.0
- [uint8arraylist](https://npm.io/package/uint8arraylist.md) ^2.0.0
- [it-stream-types](https://npm.io/package/it-stream-types.md) ^2.0.1

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 4.1.3 (latest) — 2023-04-18
- 4.1.2 — 2022-08-11
- 4.1.1 — 2022-08-10
- 4.1.0 — 2022-08-03
- 4.0.1 — 2022-07-31
- 4.0.0 — 2022-06-15
- 3.0.1 — 2022-02-16
- 3.0.0 — 2022-01-14
- 2.0.0 — 2021-04-08
- 1.0.2 — 2020-08-12
- 1.0.1 — 2019-10-30
- 1.0.0 — 2019-09-26

## README

# it-handshake <!-- omit in toc -->

[![codecov](https://img.shields.io/codecov/c/github/jacobheun/it-handshake.svg?style=flat-square)](https://codecov.io/gh/jacobheun/it-handshake)
[![CI](https://img.shields.io/github/actions/workflow/status/jacobheun/it-handshake/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/jacobheun/it-handshake/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)

> Create handshakes for binary protocols with iterable streams

## Table of contents <!-- omit in toc -->

- [Install](#install)
  - [Browser `<script>` tag](#browser-script-tag)
- [API](#api)
  - [`handshake(duplex)`](#handshakeduplex)
  - [`shake.write(message)`](#shakewritemessage)
  - [`shake.read()`](#shakeread)
  - [`shake.rest()`](#shakerest)
  - [`shake.stream`](#shakestream)
  - [`shake.reader`](#shakereader)
  - [`shake.writer`](#shakewriter)
- [Related](#related)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i it-handshake
```

### Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `ItHandshake` in the global namespace.

```html
<script src="https://unpkg.com/it-handshake/dist/index.min.js"></script>
```

## API

### `handshake(duplex)`

- `duplex: DuplexIterable` A [duplex iterable stream](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it)

Returns a new handshake instance that produces [`BufferList`](https://www.npmjs.com/package/bl) objects.

### `shake.write(message)`

- `message: String|Buffer|BufferList`

### `shake.read()`

Returns the next [`BufferList`](https://www.npmjs.com/package/bl) message in the stream.

### `shake.rest()`

Ends the writer. This is necessary for continuing to pipe data through `shake.stream`

### `shake.stream`

The [duplex iterable stream](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it) to be used once the handshake is complete.

### `shake.reader`

The underyling [it-reader](https://github.com/alanshaw/it-reader) used by `shake.read()`. While direct usage of the reader is typically unnecessary, it is available for advanced usage.

### `shake.writer`

The underyling writer, [it-pushable](https://github.com/alanshaw/it-pushable), used by `shake.write()`. While direct usage of the writer is typically unnecessary, it is available for advanced usage.

## Related

- [it-reader](https://github.com/alanshaw/it-reader)
- [it-pushable](https://github.com/alanshaw/it-pushable)
- [it-pair](https://github.com/alanshaw/it-pair)
- [it-pipe](https://github.com/alanshaw/it-pipe)

## API Docs

- <https://jacobheun.github.io/it-handshake>

## License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

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