{"id":13836495,"url":"https://github.com/hilleer/kill-port-process","last_synced_at":"2025-04-06T00:09:14.732Z","repository":{"id":34093638,"uuid":"155994152","full_name":"hilleer/kill-port-process","owner":"hilleer","description":"Kill long running process(es) on port(s) programatically or with the CLI","archived":false,"fork":false,"pushed_at":"2025-03-17T16:53:29.000Z","size":405,"stargazers_count":28,"open_issues_count":5,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T23:09:28.820Z","etag":null,"topics":["kill-port","kill-port-process","kill-process","node"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hilleer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-03T15:05:15.000Z","updated_at":"2025-03-17T16:53:32.000Z","dependencies_parsed_at":"2023-10-02T18:09:53.879Z","dependency_job_id":"cd0daf93-d75d-423e-8732-9bc2cc5e9878","html_url":"https://github.com/hilleer/kill-port-process","commit_stats":{"total_commits":181,"total_committers":4,"mean_commits":45.25,"dds":0.430939226519337,"last_synced_commit":"25dfcb66b98f8558b8b8fd1a769fe8b8fe642a40"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilleer%2Fkill-port-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilleer%2Fkill-port-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilleer%2Fkill-port-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilleer%2Fkill-port-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hilleer","download_url":"https://codeload.github.com/hilleer/kill-port-process/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415967,"owners_count":20935387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kill-port","kill-port-process","kill-process","node"],"created_at":"2024-08-04T15:00:47.214Z","updated_at":"2025-04-06T00:09:14.715Z","avatar_url":"https://github.com/hilleer.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/hilleer"],"categories":["脚手架以及工具包"],"sub_categories":[],"readme":"# Kill-port-process\n\n[![npm version](https://badge.fury.io/js/kill-port-process.svg)](https://badge.fury.io/js/kill-port-process)\n[![Test](https://github.com/hilleer/kill-port-process/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/hilleer/kill-port-process/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/hilleer/kill-port-process/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/hilleer/kill-port-process/actions/workflows/github-code-scanning/codeql)\n\n**Cross-platform** module to stop one (or more) process(es) running on a port (or a list of ports).\n\n## Install\n\n```bash\n$ npm install kill-port-process\n# or\n$ yarn add kill-port-process\n```\n\n## Usage\n\n### Programmatically\n\n```javascript\nconst { killPortProcess } = require('kill-port-process');\n\n(async () =\u003e {\n  // long running process running on a given port(s), e.g. a http-server\n  // takes a number, number[], string or string[]\n  // single port\n  await killPortProcess(1234);\n\n  // multiple ports\n  await killPortProcess([1234, 6789]);\n\n  // with options\n  await killPortProcess(1234, { signal: 'SIGTERM' });\n})();\n```\n\n#### Options\n\n* `signal` (optional): used to determine the command used to kill the provided port(s). Valid values are:\n  * `SIGKILL` (default)\n  * `SIGTERM`\n\n### CLI\n\nInstall the module globally:\n\n```bash\nnpm install kill-port-process -g\n```\n\nYou can use the CLI calling it with `kill-port \u003cport\u003e`.\n\nIt takes a single port or a list of ports separated by a space. Valid flags are `-p` and `--port` but are both optional.\n\n```bash\n$ kill-port 1234\n# or multiple ports, separated by space(s)\n$ kill-port 1234 2345\n# or\n$ kill-port -p 1234\n# or\n$ kill-port --port 1234\n```\n\n#### Flags\n\n* `--graceful` kill the process gracefully.\n  * **Unix:** Sends a `-15` signal to kill (`SIGTERM`) rather than `-9` (`SIGKILL`)\n  * **Win:** Currently no use\n\n## Compatibility\n\nCompiled for [es5](https://compat-table.github.io/compat-table/es5) and supported by node v16 and onwards.\n\n---\n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/hilleer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhilleer%2Fkill-port-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhilleer%2Fkill-port-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhilleer%2Fkill-port-process/lists"}