Socket
Socket
Sign inDemoInstall

check-internet-connected

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    check-internet-connected

Utility to check if internet is connected or not


Version published
Weekly downloads
4.1K
increased by4.12%
Maintainers
1
Install size
621 kB
Created
Weekly downloads
 

Readme

Source

check-internet-connected

A node module that does a TCP connection to check whether we are connected to Internet or not

Usage:-

npm install check-internet-connected
const checkInternetConnected = require('check-internet-connected');
checkInternetConnected()
  .then((result) => {
    console.log(result);//successfully connected to a server
  })
  .catch((ex) => {
    console.log(ex); // cannot connect to a server or error occurred.
  });
Additional Config
const config = {
  timeout: 5000, //timeout connecting to each server, each try
  retries: 5,//number of retries to do before failing
  domain: 'https://apple.com',//the domain to check DNS record of
}
checkInternetConnected(config);

Keywords

FAQs

Last updated on 07 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc