{"name":"is-online","version":"9.0.0","description":"Check if the internet connection is up","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-online.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"contributors":[{"name":"silverwind","email":"me@silverwind.io","url":"github.com/silverwind"}],"engines":{"node":">=10"},"scripts":{"test":"xo && ava test.js && tsd"},"keywords":["browser","online","offline","is-online","network","connected","connectivity","internet","is","has","detect","hostname","hostnames","dns","socket","reachable","reachability","accessible","no","disconnected"],"dependencies":{"got":"^11.8.0","p-any":"^3.0.0","p-timeout":"^3.2.0","public-ip":"^4.0.2"},"devDependencies":{"ava":"^2.4.0","tsd":"^0.13.1","xo":"^0.34.1"},"browser":"browser.js","xo":{"rules":{"unicorn/prefer-optional-catch-binding":"off"}},"gitHead":"87688b4db9fe15a60088a57d46769b99f8c27dfe","bugs":{"url":"https://github.com/sindresorhus/is-online/issues"},"homepage":"https://github.com/sindresorhus/is-online#readme","_id":"is-online@9.0.0","_nodeVersion":"14.11.0","_npmVersion":"6.14.8","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-P53pg5IPdfE19JB51ckbzl5ZT5/+pQAIX/QfuOx0qQLT1xuk5twnbKSxdbHC9/HrS3o69aX67HkkdYrUH9QYeA==","shasum":"0c51f93499c811f15590301a5a02dabd254e19e5","tarball":"http://registry-npm.ywwl.com/is-online/download/is-online-9.0.0.tgz","fileCount":6,"unpackedSize":7476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJflc4KCRA9TVsSAnZWagAAWhIP/i+RUeHBgUi71T008yTR\n16BlClnNGaa7IjBphoxNuQAu0syHAHCzsm+LcIwfFnebR9H9k1URx0mHk0K7\ncueO6d2L1OLjyz9dl8eXDFAhajuwhH6R48UNMl9VMMmVq+pEmpfWCIjsps/h\nMQU+f2vmDZLAVqfwvK/SrYgAnvILPvD/rjkoq7pAA8xtkRcFRn9G2OeUhDu2\niERP8IX94C4ZCseVHXO8v8P/N9b0d/o4+pdXEGpHvTCioMagSPDzZLWb+frv\nbCrnLAK2yNs9SIE3+/XakSfIMWjsqtdz5Mb/ZRZKXLQuj8dUOyHvGXZ2bK8G\n85U0ItsnVgRFbKXHevbD8WEO7/IuUlJ9d+7dE+PNQ/sxan3YNKXIk7KLx005\ngLOIkE739Qs8RtHFCqApBGInfaw3/WNuREgakKjlTqMNLpw4mqBAZgpHfVU7\n1OXbdUGAhIpJjqY6Ryo7PT/bpR28hnn7+FXx29/OmNiusc63TJv+vEsjwRQd\n1yjM4gxICoIonchp2bqL6m9j4zoBQXBm4/rlQHNc8/Bk0MzVUKylpuKQIHGu\nP7JkTPjvQ9D97qzNSZhjsJIVOmHR99nM0Nw9BJAC6/OLdMcHpteKiV6+doOz\nvVx5lRlKrquCnhYgHmGxMVxWNrWsZCxyfZrLfgYUhQJB+QrqjKzjGCZY8e5L\nFef/\r\n=IkEE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlJf2M8D6l8ZZoNYLYmi8VEmRMPm8tTh1ym74CZ00AigIgV1Lddj653/mFwo9pyKXaCDdgaj1x7wAzht9v3GmZg8w="}],"size":3250,"noattachment":false,"key":"/is-online/-/is-online-9.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"silverwind","email":"npm@silverwind.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-online_9.0.0_1603653130547_0.15502718335442167"},"_hasShrinkwrap":false,"readme":"# is-online\n\n> Check if the internet connection is up\n\nWorks in Node.js and the browser *(with a bundler)*.\n\nIn the browser, there is already [`navigator.onLine`](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine.onLine), but it's useless as it only tells you if there's a local connection, and not whether the internet is accessible.\n\n## Install\n\n```sh\nnpm install is-online\n```\n\n## Usage\n\n```js\nimport isOnline from 'is-online';\n\nconsole.log(await isOnline());\n//=> true\n```\n\n## API\n\n### isOnline(options?)\n\n#### options\n\nType: `object`\n\n##### timeout\n\nType: `number`\\\nDefault: `5000`\n\nMilliseconds to wait for a server to respond.\n\n##### ipVersion\n\nType: `number`\\\nValues: `4 | 6`\\\nDefault: `4`\n\nThe [Internet Protocol version](https://en.wikipedia.org/wiki/Internet_Protocol#Version_history) to use.\n\nThis is an advanced option that is usually not necessary to be set, but it can prove useful to specifically assert IPv6 connectivity.\n\n## How it works\n\nThe following checks are run in parallel:\n\n- Retrieve [icanhazip.com](https://github.com/major/icanhaz) (or [ipify.org](https://www.ipify.org) as fallback) via HTTPS.\n- Query `myip.opendns.com` and `o-o.myaddr.l.google.com` DNS entries. *(Node.js only)*\n- Retrieve Apple's Captive Portal test page (this is what iOS does). *(Node.js only)*\n\nWhen any check succeeds, the returned Promise is resolved to `true`.\n\n## Proxy support\n\nTo make it work through proxies, you need to set up [`global-agent`](https://github.com/gajus/global-agent).\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [silverwind](https://github.com/silverwind)\n\n## Related\n\n- [is-online-cli](https://github.com/sindresorhus/is-online-cli) - CLI for this module\n- [is-reachable](https://github.com/sindresorhus/is-reachable) - Check if servers are reachable\n","publish_time":1603653130659,"_cnpm_publish_time":1603653130659,"dist-tags":{"latest":"12.0.2"}}