{"repo":"sindresorhus/is-online","free":true,"listed":false,"github":"https://github.com/sindresorhus/is-online","clone":"git clone https://github.com/sindresorhus/is-online.git","description":"Check if the internet connection is up","language":"JavaScript","stars":1357,"topics":["internet","internet-connection","nodejs","javascript","browser","connectivity","detect","network","online","ping"],"license":"MIT","category":"dev-tools","readme_excerpt":"is-online Check if the internet connection is up Works in Node.js and the browser (with a bundler) . In the browser, there is already navigator.onLine , but it's useless as it only tells you if there's a local connection, and not whether the internet is accessible. Install Requirements - Node.js 20+ - Works in modern browsers when bundled (requires fetch API support) Usage With timeout With abort signal With fallback URLs API isOnline(options?) Returns a Promise that resolves to true if the internet connection is up, false otherwise. options Type: object timeout Type: number \\ Default: 5000 Milliseconds to wait for a server to respond. signal Type: AbortSignal An AbortSignal to abort the operation. When the signal is aborted, the promise will resolve to false . ipVersion Type: number \\ Values: 4 6 \\ Default: 4 The Internet Protocol version to use. This is an advanced option that is usually not necessary to be set, but it can prove useful to specifically assert IPv6 connectivity. fallbackUrls Type: string[] Fallback URLs to check for connectivity. Only HTTP and HTTPS URLs are supported. In Node.js, these URLs are checked only if all default connectivity checks fail. In the browser, these URLs are checked in parallel with the default checks for better resilience against ad blockers. How it works The following checks are run in parallel: Node.js: - Retrieve icanhazip.com (or ipify.org as fallback) via HTTPS. - Query myip.opendns.com and o-o.myaddr.l.google.com DNS entries. - Ret","default_branch":null,"files":null,"tree":[],"storefront":"/r/sindresorhus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sindresorhus/is-online/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}