{"name":"is-online","version":"9.0.1","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.4"},"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":"b9b5710d1c18d945f6939583825c4a954cd908b8","bugs":{"url":"https://github.com/sindresorhus/is-online/issues"},"homepage":"https://github.com/sindresorhus/is-online#readme","_id":"is-online@9.0.1","_nodeVersion":"14.16.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-+08dRW0dcFOtleR2N3rHRVxDyZtQitUp9cC+KpKTds0mXibbQyW5js7xX0UGyQXkaLUJObe0w6uQ4ex34lX9LA==","shasum":"71a34202fa826bae6f3ff8bea420c56573448a5f","tarball":"http://registry-npm.ywwl.com/is-online/download/is-online-9.0.1.tgz","fileCount":6,"unpackedSize":7320,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2wFsCRA9TVsSAnZWagAAyw0P/0Dap13+2nED5DNgy0xw\nmh676DximY0XV/oL4LDdJwh9yM7H8zsskpkUCVZycEpV4hgzJrD+YfDYJ1hG\nav83d6unoekLKiQTCFt1nKJ5rX0Gde9Al1WcgXsOKua0tSDKLWzTVyaCR5i4\nHb4O7jZHt707RlR9Os5mV2a8zylqEIxx6Z6vtUIMKNX4T5E/zhpcEkVFKhc/\n/E1m7Q1I7I3oSrPyCRmc6xsuIAARbfzOVQtqfZRjF1f/nbcVOFXG95NDIIc/\nuXp3ni3qJw7xFZ0/QCsclB4ufV9Rq8+KxzPCvhoLKR0Yjse2V7wbl96qv0jy\nYcQeoTIcYUgJN98ZJe3ILHW+vzBpwKHWbx5etfVsUckit6CF5o65CvK3OReR\noPFM0A0p8jVcl0bkb4HjKf29MXgJ1uRdVu33F9LGwKgEHonDpIjlqJfFAiwp\nm22XR6/kmG+Swmhk3ELzjwQouYTHmSYkk3kTW4PO8oQSwS0wglMS1ZDiJdWk\nkvYzeXoy7IkUIHru6aKDRvknfKzJeVgmjkU0tzTeikmRzBFw3igH+O/Ezn2g\ncFgRzs5e6ypfm7sO2ruj+Ha+5xaOOz+iSTkAu1XyNu9srVvm++szO43Ko+dw\nLO2jFJ0o98qkC3mMKJv1cNfdxaOUiT/+4XHH+VwHzuBXDInk2DaHsEcQLLZK\nLvpT\r\n=I8iR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEPTZtSB1qKR7OIM/4LX5/tm4MQVRp2q/wd8o+aZjImEAiEA6wbClzecMMVQP1Lus+aabtFJGwykdA0rYtaekAnBEeI="}],"size":3178,"noattachment":false,"key":"/is-online/-/is-online-9.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"silverwind","email":"npm@silverwind.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-online_9.0.1_1623472806063_0.06386575590671395"},"_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":1623472806474,"_cnpm_publish_time":1623472806474,"dist-tags":{"latest":"12.0.2"}}