# killable

> Keeps track of a server's open sockets so they can be destroyed at a moment's notice.

Latest version **1.0.1** (published 2018-09-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install killable
pnpm add killable
yarn add killable
bun add killable
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-09-07 |
| First published | 2014-12-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Marten de Vries |
| Maintainers | commandoline |
| Keywords | express, http, server, socket, kill, truncate, destroy, restart, shutdown, immeadiately |

## Links

- npm: https://www.npmjs.com/package/killable
- Repository: https://github.com/marten-de-vries/killable
- Homepage: https://github.com/marten-de-vries/killable#readme
- Issues: https://github.com/marten-de-vries/killable/issues
- npm.io page: https://npm.io/package/killable

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-09-07
- 1.0.0 — 2014-12-18

## README

killable
========

Keeps track of a server's open sockets so they can be destroyed at a
moment's notice. This way, the server connection can be killed very
fast.

Installation
------------

```
npm install killable
```

Example usage
-------------

Using express:
('server' in the example is just an ``http.server``, so other frameworks
or pure Node should work just as well.)

```javascript
var killable = require('killable');

var app = require('express')();
var server;

app.route('/', function (req, res, next) {
  res.send('Server is going down NOW!');

  server.kill(function () {
    //the server is down when this is called. That won't take long.
  });
});

var server = app.listen(8080);
killable(server);
```

API
---

The ``killable`` module is callable. When you call it on a Node
``http.Server`` object, it will add a ``server.kill()`` method on it. It
returns the server object.

``server.kill([callback])`` closes all open sockets and calls
``server.close()``, to which the ``callback`` is passed on.

Inspired by: http://stackoverflow.com/a/14636625

License
-------

ISC

---
_Source: https://npm.io/package/killable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
