node-http-ping

A simple module for pinging websites

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
node-http-ping
800.3.16 years ago9 years agoMinified + gzip package size for node-http-ping in KB

Readme

node-http-ping
A simple, light-weight JavaScript module for pinging HTTP services

Installation

npm install node-http-ping --save

Usage

import ping from 'node-http-ping'
// or
const ping = require('node-http-ping')

// Using http by default
ping('google.com', 80 /* optional */)
  .then(time => console.log(`Response time: ${time}ms`))
  .catch(() => console.log(`Failed to ping google.com`))

// Or use https
ping('https://google.com')
  .then(time => console.log(`Response time: ${time}ms`))
  .catch(() => console.log('Failed to ping google.com'))