New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodejs-tcp-ping

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-tcp-ping

TCP Ping is a Node.JS based TCP ping utility written in Typescript.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-98.66%
Maintainers
1
Weekly downloads
 
Created
Source

nodejs-tcp-ping

TCP Ping is a Node.JS based TCP ping utility written in Typescript

Getting Started

yarn add nodejs-tcp-ping

If you are using npm

npm install nodejs-tcp-ping --save

Using with JavaScript

const nodejsTcpPing = require('nodejsTcpPing');

// If you are not specify any options
// then ping localhost:80 five times
// with 5000ms timeout
nodejsTcpPing.tcpPing().then(results => {
  // It return an array of ping data
  // The returned data array (result) is looks like this,
  // if everthing was successful: [{ ping: number }, ...]
  // if some attempts timedout: [ { ping: null, error: 'Connection timed out' } ]
}).catch(reason => {
  // Or a reason why it failed
});

// There is the full specification of options
nodejsTcpPing.tcpPing({
  attempts: 5,
  host: 'localhost',
  port: 80,
  timeout: 5000
}).then(results => {
  // It return an array of ping data
}).catch(reason => {
  // Or a reason why it failed
});

Using with TypeScript

import { tcpPing, IPingData } from 'nodejsTcpPing';

tcpPing().then((result: IPingData[]) => {
  // ...
}).catch((reason: any) => {
  // ...
});

// Or

tcpPing({
  attempts: 5,
  host: 'localhost',
  port: 80,
  timeout: 5000
}).then((result: IPingData[]) => {
  // ...
}).catch((reason: any) => {
  // ...
});

Testing with yarn

1. Install all the dependencies with yarn

yarn

2. Build the lib with yarn

yarn build

3. Run all the tests with yarn

yarn test

Testing with npm

1. Install all the dependencies with npm

npm install

2. Build the lib with npm

npm run build

3. Run all the tests with npm

npm test

Keywords

FAQs

Package last updated on 10 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc