https://github.com/denorg/online
πΈοΈ Check if you're currently online in Deno
https://github.com/denorg/online
deno denoland denorg network online typescript
Last synced: 4 days ago
JSON representation
πΈοΈ Check if you're currently online in Deno
- Host: GitHub
- URL: https://github.com/denorg/online
- Owner: denorg
- License: mit
- Created: 2020-05-14T23:28:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T12:00:08.000Z (almost 5 years ago)
- Last Synced: 2025-03-24T00:38:26.069Z (22 days ago)
- Topics: deno, denoland, denorg, network, online, typescript
- Language: TypeScript
- Homepage: https://denorg.github.io/online/
- Size: 22.5 KB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno-cn - @denorg/online
- awesome-deno - online - Check if you're currently online in Deno. (Modules / Online Playgrounds)
- awesome-deno - online - Check if you're currently online in Deno. (Modules / Utils)
README
# πΈοΈ Online
Check if your machine is currently online and connected to the internet in Deno.
[](https://github.com/denorg/online/actions)
[](https://github.com/denorg/online/blob/master/LICENSE)
[](https://github.com/denorg/online/graphs/contributors)
[](https://denorg.github.io/starter/)
[](https://github.com/denorg)
[](https://github.com/denorg/online)
[](https://github.com/semantic-release/semantic-release)## β Getting started
Import the `isOnline` function and use it:
```ts
import { isOnline } from "https://deno.land/x/online/mod.ts";const amIOnline = await isOnline(); // boolean
```### CLI with [DPX](https://github.com/denorg/dpx)
After [installing DPX](https://github.com/denorg/dpx), you can directly use the CLI using the `dpx` command:
```bash
dpx online --allow-net
# You are not in a Docker environment
```### CLI
Alternatively, you can use it directly from the CLI by using `deno run`:
```bash
deno run --allow-read https://deno.land/x/online/cli.ts
```You can also install it globally using the following:
```bash
deno install --allow-read -n online https://deno.land/x/online/cli.ts
```Then, the package is available to run:
```bash
online # You are online
```### Configuration
Required permissions:
1. `--allow-net`
## π©βπ» Development
Run tests:
```bash
deno test --allow-net
```## β Related Work
- [sindresorhus/is-online](https://github.com/sindresorhus/is-online) is the Node.js project serving as inspiration for this one
## π License
MIT Β© [Denorg](https://den.org.in)
A project by Denorg, the world's first Deno-focused community
organization and consulting company. Work with us β