-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
Package to replace
portfinder
Suggested replacement(s)
Manifest type
preferred (lighter or more modern alternative package)
Rationale
Finding a free port is a very common operation in a lot of dev tools etc.
Portfinder does this, and has been a good solution for a long time, widely used across the ecosystem with 12 million downloads a week.
Unfortunately, it comes with a fair bit of baggage & legacy. The package itself is 23KB but comes with some heavy deps that bring the full install to nearly 1MB. It doesn't support ESM and its APIs are primarily callback focused (although getPortPromise exists, naming is clearly awkward).
Get-Port is a single file, 14KB total with zero dependencies, and supports all the core API very neatly with a modern & simple setup.
Availability
No response
Code example (optional)
const portfinder = require('portfinder');
portfinder.getPort(function (err, port) {
console.log('Got free port:', port);
// Use the port
});
import getPort from 'get-port';
console.log(await getPort());
// Use the portReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels