Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-http-ping with all npm packages installed. Try it out:

var nodeHttpPing = require("node-http-ping")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-http-ping v0.3.1

A simple module for pinging websites

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'))

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free