# connection-tester

> test if the connection can be established with the given host and port

Latest version **0.2.1** (published 2020-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install connection-tester
pnpm add connection-tester
yarn add connection-tester
bun add connection-tester
```

## 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.2.1 |
| Published | 2020-12-16 |
| First published | 2013-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Sanjeev Koranga |
| Maintainers | skoranga |
| Keywords | connection test, nodejs |

## Links

- npm: https://www.npmjs.com/package/connection-tester
- Repository: https://github.com/skoranga/node-connection-tester
- Issues: https://github.com/skoranga/node-connection-tester/issues
- npm.io page: https://npm.io/package/connection-tester

## Recent versions

- 0.2.1 (latest) — 2020-12-16
- 0.2.0 — 2018-01-02
- 0.1.2 — 2017-01-09
- 0.1.1 — 2016-06-30
- 0.1.0 — 2016-01-20
- 0.0.7 — 2015-10-06
- 0.0.6 — 2015-03-30
- 0.0.5 — 2014-11-18
- 0.0.4 — 2014-11-10
- 0.0.3 — 2014-11-05
- 0.0.2 — 2013-12-06

## README

connection-tester
=================

[![Build Status](https://travis-ci.org/skoranga/node-connection-tester.png)](https://travis-ci.org/skoranga/node-connection-tester)

Test to check if the connection can be established or host/port reachable for a given host and port. Useful for testing all the connection in your node application at server startup.


### How to Use

#### Async version

```javascript
const connectionTester = require('connection-tester');

connectionTester.test(
    'www.yahoo.com',  // host
    80,               // port
    1000,             // connection timeout
    (err, output) => {
        console.log(output);
    }
);

connectionTester.test(
    'api.paypal.com', // host
    443,              // port
    1000,             // connection timeout
    (err, output) => {
        console.log(output);
    }
);
```

#### Sync version

```javascript
const connectionTester = require('connection-tester');

console.log(connectionTester.test('www.yahoo.com', 80, 1000));
console.log(connectionTester.test('api.paypal.com', 443, 1000));
```

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