# zeronet-client

> ZeroNet protocol client

Latest version **0.3.7** (published 2018-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install zeronet-client
pnpm add zeronet-client
yarn add zeronet-client
bun add zeronet-client
```

## 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.3.7 |
| Published | 2018-02-25 |
| First published | 2017-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Maciej Krüger |
| Maintainers | mkg20001 |
| Keywords | zeronet, protocol, client |

## Links

- npm: https://www.npmjs.com/package/zeronet-client
- Repository: https://github.com/ZeroNetJS/zeronet-client
- Homepage: https://github.com/ZeroNetJS/zeronet-client#readme
- Issues: https://github.com/ZeroNetJS/zeronet-client/issues
- npm.io page: https://npm.io/package/zeronet-client

## Dependencies (4)

- [bl](https://npm.io/package/bl.md) ^1.2.1
- [pull-stream](https://npm.io/package/pull-stream.md) ^3.6.2
- [pull-pushable](https://npm.io/package/pull-pushable.md) ^2.2.0
- [zeronet-msgpack](https://npm.io/package/zeronet-msgpack.md) ^3.6.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.3.7 (latest) — 2018-02-25
- 0.3.6 — 2018-01-25
- 0.3.5 — 2017-12-27
- 0.3.4 — 2017-12-14
- 0.3.3 — 2017-12-14
- 0.3.2 — 2017-12-13
- 0.3.1 — 2017-11-28
- 0.3.0 — 2017-11-28
- 0.2.3 — 2017-11-26
- 0.2.2 — 2017-11-25
- 0.2.1 — 2017-11-25
- 0.2.0 — 2017-11-25
- 0.0.1-alpha18 — 2017-09-10
- 0.0.1-alpha17 — 2017-08-10
- 0.0.1-alpha16 — 2017-08-10
- … 9 more at https://npm.io/package/zeronet-client/versions

## README

# zeronet-client

ZeroNet Protocol Client

# Example
```js
'use strict'

const Client = require('zeronet-client')
const TCP = require('libp2p-tcp')
const tcp = new TCP()
const multiaddr = require('multiaddr')

const server = tcp.createListener()

const handlers = { // usually this object is autogenerated by zeronet-protocol
  ping: (data, cb) => cb(null, {body: 'Pong!'})
}

server.on('connection', conn => Client(conn, handlers, true))

const addr = multiaddr('/ip4/127.0.0.1/tcp/1234')

server.listen(addr)

server.once('listening', () => {
  const client = Client(tcp.dial(addr))

  client.request('ping', {}, (err, data) => {
    if (err) throw err
    if (data) console.log('Got ping back: %s', data.body)

    server.close()
  }, true) // isServer
})
```

# API

`Client(conn, handlers, isServer)`: Wraps an interface-connection stream instance into a client.
  Returns: ZeroNetClient

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