https://github.com/beyondjs/ports
A lightweight Node.js utility package for checking port availability on a system. This simple tool provides an easy-to-use API to determine if a specific network port is free or in use, making it ideal for applications that need to dynamically allocate ports or verify port availability before binding.
https://github.com/beyondjs/ports
Last synced: 5 months ago
JSON representation
A lightweight Node.js utility package for checking port availability on a system. This simple tool provides an easy-to-use API to determine if a specific network port is free or in use, making it ideal for applications that need to dynamically allocate ports or verify port availability before binding.
- Host: GitHub
- URL: https://github.com/beyondjs/ports
- Owner: beyondjs
- License: mit
- Created: 2022-12-01T13:33:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-13T23:03:54.000Z (almost 2 years ago)
- Last Synced: 2025-09-21T00:21:33.083Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @beyond-js/ports
A simple utility package to check if a port is available on the system.
## Installation
Install the package using npm:
```bash
npm install @beyond-js/ports
```
## Usage
Here's a basic example of how to use the `@beyond-js/ports` package:
```javascript
const ports = require('@beyond-js/ports');
async function checkPort(port) {
const isAvailable = await ports.check(port);
console.log(`Port ${port} is ${isAvailable ? 'available' : 'in use'}`);
}
checkPort(3000);
```
## API
### `check(port)`
Checks if the specified port is available.
- `port` (number): The port number to check.
- Returns: A Promise that resolves to `true` if the port is available, `false` otherwise.
## License
MIT © [[BeyondJS](https://beyondjs.com)]