README
ping-net-check
A Node.js Module to check whether you are connected to network or not. Returns a promise resolves to true with network access and to false without network access.
Install Module
npm install ping-net-check
Note: Requires Node >= 8.0.0
Usage
With Default Options
- host: google.com
- timeout: 2000
const { netCheck } = require('ping-net-check');
netCheck().then(value => console.log(value));
// prints 'true' or 'false' depending on networking connectivity
With Options
- timeout: milliseconds
- host: string without protocol
const { netCheck } = require('ping-net-check');
netCheck({
timeout: 3000,
host: 'example.com'
}).then(value => console.log(value));
// prints 'true' or 'false' depending on networking connectivity