What is fkill?
The fkill npm package is a utility for forcefully killing processes. It provides a simple and user-friendly way to terminate processes by their name, port, or PID (Process ID).
What are fkill's main functionalities?
Kill a process by name
This feature allows you to kill a process by specifying its name. In this example, the 'chrome' process is terminated.
const fkill = require('fkill');
fkill('chrome').then(() => {
console.log('Chrome has been killed');
});
Kill a process by PID
This feature allows you to kill a process by specifying its PID. In this example, the process with PID 1337 is terminated.
const fkill = require('fkill');
fkill(1337).then(() => {
console.log('Process with PID 1337 has been killed');
});
Kill a process by port
This feature allows you to kill a process by specifying the port it is using. In this example, the process running on port 8080 is terminated.
const fkill = require('fkill');
fkill(':8080').then(() => {
console.log('Process running on port 8080 has been killed');
});
Force kill a process
This feature allows you to forcefully kill a process. In this example, the 'node' process is forcefully terminated.
const fkill = require('fkill');
fkill('node', {force: true}).then(() => {
console.log('Node process has been forcefully killed');
});
Other packages similar to fkill
taskkill
The taskkill package provides similar functionality to fkill, allowing you to kill processes by name or PID. It is more Windows-centric and uses the Windows taskkill command under the hood.
ps-node
The ps-node package allows you to search for and kill processes by name or PID. It provides more detailed process information and is cross-platform, but it requires more configuration compared to fkill.
kill-port
The kill-port package is focused on killing processes by port. It is simpler and more specialized compared to fkill, which offers a broader range of process-killing options.
Fabulously kill processes. Cross-platform.
Works on macOS, Linux, Windows.
Install
$ npm install --save fkill
Usage
const fkill = require('fkill');
fkill(1337).then(() => {
console.log('Killed process');
});
fkill('Safari');
fkill([1337, 'Safari']);
API
fkill(input, [options])
Returns a promise.
input
Type: number
string
Array<number|string>
One or more process IDs/names to kill.
options
force
Type: boolean
Default: false
Force kill the process.
Related
License
MIT © Sindre Sorhus