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

2.0.3 • Public • Published

Installation

npm install --save @types/kill-port

Summary

This package contains type definitions for kill-port (https://github.com/tiaanduplessis/kill-port).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/kill-port.

index.d.ts

/// <reference types="node" />

import type { SuccessfulExec } from "shell-exec";

export = killPort;

/**
 * Kill the process running on given port.
 *
 * @param port Port where the process is running.
 * @param protocol Protocol for the port.
 *
 * @example
 * import kill = require('kill-port')
 * import * as http from 'http';
 * const port = 8080
 *
 * const server = http.createServer((req, res) => {
 *   res.writeHead(200, {
 *     'Content-Type': 'text/plain'
 *   })
 *
 *   res.end('Hi!')
 * })
 *
 * server.listen(port, () => {
 *   setTimeout(() => {
 *     // Currently you can kill ports running on TCP or UDP protocols
 *     kill(port, 'tcp')
 *       .then(console.log)
 *       .catch(console.log)
 *   }, 1000)
 * })
 */
declare function killPort(
    port: number,
    /** @default 'tcp' */
    protocol?: "tcp" | "udp",
): Promise<SuccessfulExec>;

Additional Details

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/kill-port

Weekly Downloads

5,174

Version

2.0.3

License

MIT

Unpacked Size

4.46 kB

Total Files

5

Last publish

Collaborators

  • types