# chrome-net

> Use the Node `net` API in Chrome Apps

Latest version **3.3.4** (published 2020-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install chrome-net
pnpm add chrome-net
yarn add chrome-net
bun add chrome-net
```

## 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 | 3.3.4 |
| Published | 2020-05-17 |
| First published | 2013-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 38.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 136 |
| Author | Feross Aboukhadijeh |
| Maintainers | feross, jscissr |
| Keywords | chrome app, chrome.socket, socket api, net, tcp, wrapper, client, server |

## Links

- npm: https://www.npmjs.com/package/chrome-net
- Repository: https://github.com/feross/chrome-net
- Issues: https://github.com/feross/chrome-net/issues
- Funding: https://github.com/sponsors/feross
- npm.io page: https://npm.io/package/chrome-net

## Dependencies (1)

- [inherits](https://npm.io/package/inherits.md) ^2.0.1

## 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

- 3.3.4 (latest) — 2020-05-17
- 3.3.3 — 2019-08-13
- 3.3.2 — 2019-05-13
- 3.3.1 — 2018-04-17
- 3.3.0 — 2016-07-06
- 3.2.0 — 2016-04-12
- 3.1.3 — 2016-03-18
- 3.1.2 — 2016-03-16
- 3.1.1 — 2016-01-13
- 3.1.0 — 2015-12-07
- 3.0.1 — 2015-08-13
- 3.0.0 — 2015-08-10
- 2.5.0 — 2015-07-02
- 2.4.3 — 2015-05-04
- 2.4.2 — 2015-02-21
- … 27 more at https://npm.io/package/chrome-net/versions

## README

# chrome-net [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

[travis-image]: https://img.shields.io/travis/feross/chrome-net/master.svg
[travis-url]: https://travis-ci.org/feross/chrome-net
[npm-image]: https://img.shields.io/npm/v/chrome-net.svg
[npm-url]: https://npmjs.org/package/chrome-net
[downloads-image]: https://img.shields.io/npm/dm/chrome-net.svg
[downloads-url]: https://npmjs.org/package/chrome-net
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

### Use the Node `net` API in Chrome Apps

This module lets you use the Node.js [net](https://nodejs.org/api/net.html) (TCP) API in [Chrome Packaged Apps](https://developer.chrome.com/apps/about_apps).

Instead of learning the quirks of Chrome's `chrome.sockets` API for networking in Chrome Apps just **use the higher-level node API you're familiar with**. Then, compile your code with [browserify](https://github.com/substack/node-browserify) and you're all set!

## install

```
npm install chrome-net
```

## methods

Use node's `net` API, including all parameter list shorthands and variations.

Example TCP client:

```js
var net = require('chrome-net')

var client = net.createConnection({
  port: 1337,
  host: '127.0.0.1'
})

client.write('beep')

client.on('data', function (data) {
  console.log(data)
})

// .pipe() streaming API works too!

```

Example TCP server:

```js
var net = require('chrome-net')

var server = net.createServer()

server.on('listening', function () {
  console.log('listening')
})

server.on('connection', function (sock) {
  console.log('Connection from ' + sock.remoteAddress + ':' + sock.remotePort)
  sock.on('data', function (data) {
    console.log(data)
  })
})

server.listen(1337)

```

See nodejs.org for full API documentation: [net](https://nodejs.org/api/net.html)

## contribute

To run tests, use `npm test`. The tests will run TCP and UDP servers and launch a few different Chrome Packaged Apps with browserified client code. The tests currently require Chrome on Windows or Chrome Canary on Mac. If you're on Linux, feel free to send a pull request to fix this limitation.

## license

MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org), John Hiesey & Jan Schär.

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