JSPM

internet-available

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 573
  • Score
    100M100P100Q95616F
  • License MIT

A module to verify if there's an active internet connection with Node.js

Package Exports

  • internet-available

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (internet-available) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

internet-available

A module to verify if there's an active internet connection with Node.js

Installation

You can install this module through NPM using the following command in your terminal:

$ npm install internet-available --save

Example

internet-available requires Promises to work correctly. It's easy to use:

var internetAvailable = require("internet-available");

// Most easy way
internetAvailable({
    // Provide maximum execution time for the verification
    timeout: 5000,
    // If it tries 5 times and it fails, then it will throw no internet
    retries: 5
}).then(() => {
    console.log("Internet available");
}).catch(() => {
    console.log("No internet");
});

But configurable too (check the docs).

Documentation

The official documentation of the project can be found in Our Code World here.