# connectivity

> Detect if the network is up (do we have connectivity?)

Latest version **1.0.2** (published 2019-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install connectivity
pnpm add connectivity
yarn add connectivity
bun add connectivity
```

Provides the command `connectivity`.

## 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.0.2 |
| Published | 2019-05-02 |
| First published | 2014-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 51.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 61 |
| Author | Feross Aboukhadijeh |
| Maintainers | feross |
| Keywords | online, offline, detect, network, up, down, connected, ping, on-line, off-line, connectivity, mad science |

## Links

- npm: https://www.npmjs.com/package/connectivity
- Repository: https://github.com/feross/connectivity
- Issues: https://github.com/feross/connectivity/issues
- npm.io page: https://npm.io/package/connectivity

## Dependencies (1)

- [once](https://npm.io/package/once.md) ^1.3.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-05-02
- 1.0.1 — 2018-03-02
- 1.0.0 — 2016-10-10
- 0.1.2 — 2015-05-04
- 0.1.1 — 2014-04-15
- 0.1.0 — 2014-04-15

## README

# connectivity [![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/connectivity/master.svg
[travis-url]: https://travis-ci.org/feross/connectivity
[npm-image]: https://img.shields.io/npm/v/connectivity.svg
[npm-url]: https://npmjs.org/package/connectivity
[downloads-image]: https://img.shields.io/npm/dm/connectivity.svg
[downloads-url]: https://npmjs.org/package/connectivity
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

#### Detect if the network is up (do we have connectivity?)

![internet!](https://raw.githubusercontent.com/feross/connectivity/master/img.jpg)

The module answers the most important question: is the cat-picture delivery system working?

### usage

```js
var connectivity = require('connectivity')

connectivity(function (online) {
  if (online) {
    console.log('connected to the internet!')
  } else {
    console.error('sorry, not connected!')
  }
})
```

Also works in the browser with [browserify](http://browserify.org/)!

### license

MIT. Copyright [Feross Aboukhadijeh](https://www.twitter.com/feross).

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