Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ensure-port

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensure-port

Makes sure you get an available port

  • 1.5.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Ensure Port

Build Status

Makes sure you get an available port.

Installation

npm i ensure-port
yarn add ensure-port

Usage

import { Ports } from 'ensure-port';

const ports = new Ports({
  startPort: 8000,
  endPort: 9000,
});

const port = await ports.ensure(); // This would be a random port between 8000 and 9000 that is not used (validated again file-system and http server)

// When you finish - remove watcher
await ports.dispose();

How does it work?

It saves inside your node_modules a directory that contain all the ports that are in use. This is why it works in parallel.

License

MIT

Contributing

Feel free to fork and create pull requests!

Keywords

FAQs

Package last updated on 27 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc