Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
checks for internet, works in browser and node
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
index.js
license.md
package.json
readme.md

readme.md

hasInternet

Node.js module for checking if user is connected to the internet.

To Use

Call the function hasInternet and give it a callback function, which takes in an error and a boolean for the true/false that will return for the internet's status. IS THERE INTERNET!?!

var hasInternet = require('hasinternet')

hasInternet(answer)

function answer(err, internet) {
  // there is either an error and false for internet
  // or false for error and true for internet
    // do what you need to do with that info!
  console.log(err, internet)
}
Something went wrong with that request. Please try again.