Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const dns = require('dns').promises;
- /**
- * Check connection to internet.
- *
- * @return {Promise<Boolean>} Whether there is connection to internet or not.
- */
- exports.checkInternet = function checkInternet() {
- return dns.lookup('google.com')
- .then(() => true)
- .catch(() => false);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement