# bare-tcp

> Native TCP sockets for JavaScript

Latest version **2.6.1** (published 2026-08-28) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install bare-tcp
pnpm add bare-tcp
yarn add bare-tcp
bun add bare-tcp
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.6.1 |
| Published | 2026-08-28 |
| First published | 2024-04-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 689.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Holepunch |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/bare-tcp
- Repository: https://github.com/holepunchto/bare-tcp
- Homepage: https://github.com/holepunchto/bare-tcp#readme
- Issues: https://github.com/holepunchto/bare-tcp/issues
- npm.io page: https://npm.io/package/bare-tcp

## Dependencies (3)

- [bare-dns](https://npm.io/package/bare-dns.md) ^2.0.4
- [bare-events](https://npm.io/package/bare-events.md) ^2.5.4
- [bare-stream](https://npm.io/package/bare-stream.md) ^2.6.4

## Recent versions

- 2.6.1 (latest) — 2026-08-28
- 2.6.0 — 2026-08-28
- 2.5.4 — 2026-08-04
- 2.5.3 — 2026-07-23
- 2.5.2 — 2026-07-08
- 2.5.1 — 2026-06-11
- 2.5.0 — 2026-06-04
- 2.4.2 — 2026-06-04
- 2.4.1 — 2026-06-03
- 2.4.0 — 2026-06-03
- 2.3.2 — 2026-06-03
- 2.3.1 — 2026-06-02
- 2.3.0 — 2026-06-02
- 2.2.13 — 2026-05-05
- 2.2.12 — 2026-04-22
- … 49 more at https://npm.io/package/bare-tcp/versions

## README

# bare-tcp

Native TCP sockets for JavaScript.

```
npm i bare-tcp
```

## Usage

```js
const tcp = require('bare-tcp')

const server = tcp.createServer()
server.on('connection', (socket) => socket.on('data', console.log))
server.listen(() => console.log('server is up'))

const { port } = server.address()
const socket = tcp.createConnection(port)
socket.write('hello world')
```

## API

See the [`bare-tcp` reference](https://docs.pears.com/reference/bare/modules/bare-tcp).

## License

Apache-2.0

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