Socket
Book a DemoInstallSign in
Socket

check-network-status

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-network-status

Check whether you are connected to Network or not

1.3.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Build GitHub license Twitter

check-network-status

A Node.js Module to check whether you are connected to network or not. Returns a promise resolves to true with network access and to false without network access.

Install Module

    npm install check-network-status

Note: Requires Node >= 8.0.0

Usage

With Default Options

{
    timeout: 4500,
    backUpURL: null,
    pingDomain: 'google.com',
    method: 'GET'
}
    const { checkNetworkStatus } = require('check-network-status');
    checkNetworkStatus().then(value => console.log(value));
    // prints 'true' or 'false' depending on networking connectivity

With Options

  • timeout: milliseconds
  • url: string with protocol
    const { checkNetworkStatus } = require('check-network-status');
    checkNetworkStatus({
        timeout: 3000,
        backUpURL: 'https://example.com',
        pingDomain: 'github.com',
        method: 'GET'
    }).then(value => console.log(value));
    // prints 'true' or 'false' depending on networking connectivity

ChangeLog

v1.2.0 -> v1.2.3 includes following changes

  • fixes unhandled timeout error
  • stopped printing debug logs

v1.1.3 -> v1.2.0 breaking changes include

Renamed option url to backUpURL

Added option method that accepts HTTP methods to be used while requesting backUpURL. It defaults to GET.

We updated the network check API to cloudflare DNS query API, you need to pass the pingDomain option if you don't want to use default value google.com

Keywords

online

FAQs

Package last updated on 19 May 2025

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.