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

kill-port-process

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kill-port-process

Easily kill hanging processes on ports - on any platform!

  • 3.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Kill-port-process

npm version Node.js CI CodeQL

Cross-platform module to stop one (or more) process(es) running on a port (or a list of ports).

Install

$ npm install kill-port-process
# or
$ yarn add kill-port-process

Usage

Programmatically

const { killPortProcess } = require('kill-port-process');

(async () => {
  // long running process running on a given port(s), e.g. a http-server
  // takes a number, number[], string or string[]
  // single port
  await killPortProcess(1234);

  // multiple ports
  await killPortProcess([1234, 6789]);

  // with options
  await killPortProcess(1234, { signal: 'SIGTERM' });
})();
Options
  • signal (optional): used to determine the command used to kill the provided port(s). Valid values are:
    • SIGKILL (default)
    • SIGTERM

CLI

Install the module globally:

npm install kill-port-process -g

You can use the CLI calling it with kill-port <port>.

It takes a single port or a list of ports separated by a space. Valid flags are -p and --port but are both optional.

$ kill-port 1234
# or multiple ports, separated by space(s)
$ kill-port 1234 2345
# or
$ kill-port -p 1234
# or
$ kill-port --port 1234
Flags
  • --graceful kill the process gracefully.
    • Unix: Sends a -15 signal to kill (SIGTERM) rather than -9 (SIGKILL)
    • Win: Currently no use

"Buy Me A Coffee"

Keywords

FAQs

Package last updated on 27 Nov 2023

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