@fnet/port-killer
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

@fnet/port-killer

@fnet/port-killer is a software utility designed to free up TCP ports that are currently in use by killing the runner process attached to it. It is particularly useful when there are services that have not shut down properly or that are claiming resources they shouldn't be, thus preventing other applications from using the port to establish their own connections.

Operation

This utility takes the port number to be freed up as an argument. Then, depending on the operating system that the utility is running on, it executes a specific command to identify and retrieve the process identification number (PID) of the process using that port. If a process is found, it subsequently issues a kill command to stop this process, thereby freeing up the port.

Notably, the @fnet/port-killer supports the Windows, Linux, and macOS platforms, using platform-specific commands like netstat, lsof, taskkill, and kill to interact with the system and perform tasks.

Error Handling

During the operation, if an error occurs or if the port in question is not in use by any process, the utility will return appropriate messages indicating the completion or failure of the task at hand. For instance, if there is no active process found on the input port number, it will respond with a message such as "No process found on port X. Skipping kill command." On the other hand, if the port is freed successfully, it will provide a feedback indicating successful completion, for instance, "Process on port X killed successfully."

Key Takeaways

In essence, @fnet/port-killer serves as a valuable tool for developers and system administrators dealing with port allocation issues by automating the task of identifying and killing processes unjustly occupying ports, enhancing efficiency and enabling smoother operation of applications and services.

Readme

Keywords

none

Package Sidebar

Install

npm i @fnet/port-killer

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

8.67 kB

Total Files

7

Last publish

Collaborators

  • gboyraz