Netdown
var netdown = require('netdown'),
http = require('http');
var req = http.request({ path: '/', host: 'google.com' });
req.on('error', function(err) {
if (netdown(err))
console.log('Network is down!');
else
console.log('Some other error: ' + err.message);
})
Install
$ npm install netdown --save
About
Written by Tomás Pollak. (c) Fork, Ltd. MIT Licensed.