is-all-reachable

Check if a list of hosts servers are all recheable.

Usage no npm install needed!

<script type="module">
  import isAllReachable from 'https://cdn.skypack.dev/is-all-reachable';
</script>

README

is-all-reachable

Last version Build Status Coverage Status Dependency status Dev Dependencies Status NPM Status Donate

Check if a list of hosts servers are all recheable.

Install

$ npm install is-all-reachable --save

Usage

const isAllReachable = require('is-all-reachable')

isAllReachable([
  'http://google.com',
  'http://google.es'
], (err, reachable) => {
  console.log(reachable); //=> true
});

isReachable([
  'http://aposddasd.com',
  'http://google.com'
], (err, reachable, host) => {
  console.log(reachable); //=> false
  console.log(host); //=> 'http://aposddasd.com'

});

API

isAllReachable(hosts, callback)

hosts

Required Type: array

A list of hosts to check.

callback(error, reachable, host)

Type: function

error is there only by Node.js convention and is always null.

reachable

Type: boolean

Is true if all of the hosts are reachable.

host

Type: string

First unrecheable host found.

License

MIT © Kiko Beats.