{"_id":"destroyable-server","_rev":"5-9282e3bcc0279a1d7c29e156df1fe67c","name":"destroyable-server","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"destroyable-server","version":"1.0.0","keywords":["server","close","destroy","shutdown","net","tls","http"],"author":{"name":"Tim Perry","email":"tim@httptoolkit.com"},"_id":"destroyable-server@1.0.0","maintainers":[{"name":"pimterry","email":"pimterry@gmail.com"}],"homepage":"https://github.com/httptoolkit/destroyable-server#readme","bugs":{"url":"https://github.com/httptoolkit/destroyable-server/issues"},"dist":{"shasum":"aa2d3aecff7c99b0290ef4654b94a1983e57966b","tarball":"https://registry.npmjs.org/destroyable-server/-/destroyable-server-1.0.0.tgz","fileCount":7,"integrity":"sha512-78rUr9j0b4bRWO0eBtqKqmb43htBwNbofRRukpo+R7PZqHD6llb7aQoNVt81U9NQGhINRKBHz7lkrxZJj9vyog==","signatures":[{"sig":"MEUCICp6uFx8XT8zixT5IR134Z64fYKsW2duds/mm6vmlS5mAiEAy4qOUYAvGEN4Kpy/0aUiNOxlADaeOGMTZ37SSm6PHTY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19398,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSBv8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAow//VA1lMOmn9BzpKKP8V9paOHFPV/OhxPZJz1Dbu0vHjUpSVwR1\r\nFmDL6F5Zy6h+psbEQQqdKb6+0ZPuQNTNHxTCj2L0O5AHMvUXGwIKnUNxl8o8\r\n0FtoR7bXj48fvGENVeCFJJFtB9N6npLJ8NDlMb/wrGtiBRkgjRaxDpjMb6pJ\r\nfE4qxbOIGlxJo9An+lii9EzRF9d/nWi3ktzqX7ndJu/7TtvXxgSMsc73t/gh\r\najnB4N8I8SczTj7a+VIceABlu2C3wPBtsQoJ6CrvZ8QNN1sCe443mSm488H+\r\nf1YwENuJNAgvFwuUrMnerU6d5I1JdXFl9rw5YO663fmTvADo1an6ivUnDg6H\r\na8w6qm9b9rHT5iyi5CeSW9IZ15HlGln+Np0DVIR6FdoqloMW1LwGY75QQBSS\r\nZ9o0hsM1E9/YA2hI31Hv/N5IvYuNIhsJwed/zZX3Rv9SdGZ8Q5LgA+G0g00i\r\nNdXEZwmeykWLX+I8BCtd/mnboAa8uakWGznF8P4mge/M+i6IjyNFEfCTJrBO\r\nccvlLAyfyRBMygBm5jXlyliFP6w1cb1w1tc/3uwFnTkZ2H4i0Es/FUxmRAyp\r\nSWcrQVAhIHar9DdVs7kwl0QNqmKoGKnCbOFXfnxB/yFtlm05qg2Om+MsRvrX\r\nP3+PED6x2Q+q/ne9PwBeM/Qg9TosdhBkoCs=\r\n=Gf1M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=12.0.0"},"gitHead":"e756ab7b8f6de0d7a25b335f1b5d9241b3bfe692","scripts":{"test":"mocha -r ts-node/register 'test.ts'","build":"tsc","prepack":"npm run build","pretest":"npm run build","prebuild":"rimraf dist/*"},"_npmUser":{"name":"pimterry","email":"pimterry@gmail.com"},"licenses":[{"url":"http://github.com/httptoolkit/destroyable-server/raw/main/LICENSE","type":"Apache-2.0"}],"repository":{"url":"git+ssh://git@github.com/httptoolkit/destroyable-server.git","type":"git"},"_npmVersion":"8.11.0","description":"A tiny Node.js module to make any server force-closeable","directories":{},"_nodeVersion":"16.16.0","dependencies":{"@types/node":"*"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","mocha":"^10.0.0","rimraf":"^3.0.2","ts-node":"^10.2.1","typescript":"^4.8.4","@types/chai":"^4.2.21","@types/mocha":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/destroyable-server_1.0.0_1665670140311_0.8667075950974859","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"destroyable-server","version":"1.0.1","keywords":["server","close","destroy","shutdown","net","tls","http"],"author":{"name":"Tim Perry","email":"tim@httptoolkit.com"},"_id":"destroyable-server@1.0.1","maintainers":[{"name":"pimterry","email":"pimterry@gmail.com"}],"homepage":"https://github.com/httptoolkit/destroyable-server#readme","bugs":{"url":"https://github.com/httptoolkit/destroyable-server/issues"},"dist":{"shasum":"36b3a8eff27183e798f6bd0c4bb3ff5ec23b1758","tarball":"https://registry.npmjs.org/destroyable-server/-/destroyable-server-1.0.1.tgz","fileCount":7,"integrity":"sha512-i3ZQbobNLw6EhSqgs0vFYqajDDWs0dm8JORWpQK+uRXBDxAAtGdmzTyqBkQNyr4hT6jMck3J7F2Qq6H50aJMyg==","signatures":[{"sig":"MEQCID2+CtAs5Ljk289bNWP7VYlJVVGsug3oY8/FW1qPMrecAiA6tvCzY8Me2aA/xfEf7VrezSP2lGyeDr7HThaOqyV16w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19416},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=12.0.0"},"gitHead":"b2fa4984c20b2b30cb4415b56b4c99ad4d90fd8c","scripts":{"test":"mocha -r ts-node/register 'test.ts'","build":"tsc","prepack":"npm run build","pretest":"npm run build","prebuild":"rimraf dist/*"},"_npmUser":{"name":"pimterry","email":"pimterry@gmail.com"},"licenses":[{"url":"http://github.com/httptoolkit/destroyable-server/raw/main/LICENSE","type":"Apache-2.0"}],"repository":{"url":"git+ssh://git@github.com/httptoolkit/destroyable-server.git","type":"git"},"_npmVersion":"10.2.4","description":"A tiny Node.js module to make any server force-closeable","directories":{},"_nodeVersion":"20.11.0","dependencies":{"@types/node":"*"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","mocha":"^10.0.0","rimraf":"^3.0.2","ts-node":"^10.2.1","typescript":"^4.8.4","@types/chai":"^4.2.21","@types/mocha":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/destroyable-server_1.0.1_1707751250013_0.04495378183165699","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"destroyable-server","version":"1.0.2","keywords":["server","close","destroy","shutdown","net","tls","http"],"author":{"name":"Tim Perry","email":"tim@httptoolkit.com"},"_id":"destroyable-server@1.0.2","maintainers":[{"name":"pimterry","email":"pimterry@gmail.com"}],"homepage":"https://github.com/httptoolkit/destroyable-server#readme","bugs":{"url":"https://github.com/httptoolkit/destroyable-server/issues"},"dist":{"shasum":"5257867b2207b4ae45b1d23f816ee83e078290db","tarball":"https://registry.npmjs.org/destroyable-server/-/destroyable-server-1.0.2.tgz","fileCount":7,"integrity":"sha512-Ln7ZKRq+7kr/3e4FCI8+jAjRbqbdaET8/ZBoUVvn+sDSAD7zDZA5mykkPRcrjBcaGy+LOM4ntMlIp1NMj1kMxw==","signatures":[{"sig":"MEUCICBwteZLnBxsgwu70myeiKdEbjKU9jhwY+g6UwDFNAj0AiEAnHUbwcEVKxUqVb3jnro9L8TT9Vt9j+eY7gnLObaOyLg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22041},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=12.0.0"},"gitHead":"23e7b3934eb2924b2f6ef6ff17b491abfa7b1c68","scripts":{"test":"mocha -r ts-node/register 'test.ts'","build":"tsc","prepack":"npm run build","pretest":"npm run build","prebuild":"rimraf dist/*"},"_npmUser":{"name":"pimterry","email":"pimterry@gmail.com"},"licenses":[{"url":"http://github.com/httptoolkit/destroyable-server/raw/main/LICENSE","type":"Apache-2.0"}],"repository":{"url":"git+ssh://git@github.com/httptoolkit/destroyable-server.git","type":"git"},"_npmVersion":"10.2.4","description":"A tiny Node.js module to make any server force-closeable","directories":{},"_nodeVersion":"20.11.1","dependencies":{"@types/node":"*"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","mocha":"^10.0.0","rimraf":"^3.0.2","ts-node":"^10.2.1","typescript":"^4.8.4","@types/chai":"^4.2.21","@types/mocha":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/destroyable-server_1.0.2_1714465924102_0.050030600856959984","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"destroyable-server","version":"1.1.0","keywords":["server","close","destroy","shutdown","net","tls","http"],"author":{"name":"Tim Perry","email":"tim@httptoolkit.com"},"_id":"destroyable-server@1.1.0","maintainers":[{"name":"pimterry","email":"pimterry@gmail.com"}],"homepage":"https://github.com/httptoolkit/destroyable-server#readme","bugs":{"url":"https://github.com/httptoolkit/destroyable-server/issues"},"dist":{"shasum":"f0978f3bc40032901f8a98f1dde78ead791f4e77","tarball":"https://registry.npmjs.org/destroyable-server/-/destroyable-server-1.1.0.tgz","fileCount":7,"integrity":"sha512-KbgE4nno7BWTcPXkIyvC5pqpv3sj5P25V9ydJDblMibqENelyrsxVq0bClGViOtrzD2wip+aIeP3693MF4jRyw==","signatures":[{"sig":"MEYCIQCLprGR3bi3AvFuN010C2WkQIivgsMhaTXK/953NqzbbAIhALO6wfvRdndhXqTRIIv+R2bC2uywg37wfpJvHz/UMXle","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24487},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=12.0.0"},"gitHead":"37021252d06699be42753d2ce98ed60acb70019e","scripts":{"test":"mocha -r ts-node/register 'test.ts'","build":"tsc","prepack":"npm run build","pretest":"npm run build","prebuild":"rimraf dist/*"},"_npmUser":{"name":"pimterry","email":"pimterry@gmail.com"},"licenses":[{"url":"http://github.com/httptoolkit/destroyable-server/raw/main/LICENSE","type":"Apache-2.0"}],"repository":{"url":"git+ssh://git@github.com/httptoolkit/destroyable-server.git","type":"git"},"_npmVersion":"10.8.2","description":"A tiny Node.js module to make any server force-closeable","directories":{},"_nodeVersion":"20.18.1","dependencies":{"@types/node":"*"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","mocha":"^10.0.0","rimraf":"^3.0.2","ts-node":"^10.2.1","typescript":"^4.8.4","@types/chai":"^4.2.21","@types/mocha":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/destroyable-server_1.1.0_1741617246124_0.7000496707494905","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"destroyable-server","version":"1.1.1","author":{"name":"Tim Perry","email":"tim@httptoolkit.com"},"description":"A tiny Node.js module to make any server force-closeable","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"prebuild":"rimraf dist/*","build":"tsc","prepack":"npm run build","pretest":"npm run build","test":"mocha -r ts-node/register 'test.ts'"},"engines":{"node":">=12.0.0"},"keywords":["server","close","destroy","shutdown","net","tls","http"],"licenses":[{"type":"Apache-2.0","url":"http://github.com/httptoolkit/destroyable-server/raw/main/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/httptoolkit/destroyable-server.git"},"dependencies":{"@types/node":"*"},"devDependencies":{"@types/chai":"^4.2.21","@types/mocha":"^9.0.0","chai":"^4.3.4","mocha":"^10.0.0","rimraf":"^3.0.2","ts-node":"^10.2.1","typescript":"^4.8.4"},"gitHead":"68f889dbea80e53b50e5c04dd41e0934c505046d","bugs":{"url":"https://github.com/httptoolkit/destroyable-server/issues"},"homepage":"https://github.com/httptoolkit/destroyable-server#readme","_id":"destroyable-server@1.1.1","_nodeVersion":"16.20.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-7tjgU/99QVuYSqkMXr6XdQSvXj+8TjC9NiRVWNSyGytxklZ88m+qcSvWTJ3VysE3I9wurph7dTciLEEj8aUlaQ==","shasum":"c40105e5a9d0a582e2c37924c78bced36ab0a986","tarball":"https://registry.npmjs.org/destroyable-server/-/destroyable-server-1.1.1.tgz","fileCount":7,"unpackedSize":25879,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIA8qZGktR21X6BiP2jJf3/2LZwb9qfjd99hKhyFVAjiGAiEAmw+ReM616b9Gjz8tm86uwMf3VWNzDs0XuAOkHEZVeME="}]},"_npmUser":{"name":"pimterry","email":"pimterry@gmail.com"},"directories":{},"maintainers":[{"name":"pimterry","email":"pimterry@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/destroyable-server_1.1.1_1741622299685_0.6099700395308452"},"_hasShrinkwrap":false}},"time":{"created":"2022-10-13T14:09:00.311Z","modified":"2025-03-10T15:58:20.426Z","1.0.0":"2022-10-13T14:09:00.495Z","1.0.1":"2024-02-12T15:20:50.179Z","1.0.2":"2024-04-30T08:32:04.265Z","1.1.0":"2025-03-10T14:34:06.337Z","1.1.1":"2025-03-10T15:58:19.917Z"},"bugs":{"url":"https://github.com/httptoolkit/destroyable-server/issues"},"author":{"name":"Tim Perry","email":"tim@httptoolkit.com"},"homepage":"https://github.com/httptoolkit/destroyable-server#readme","keywords":["server","close","destroy","shutdown","net","tls","http"],"repository":{"type":"git","url":"git+ssh://git@github.com/httptoolkit/destroyable-server.git"},"description":"A tiny Node.js module to make any server force-closeable","maintainers":[{"name":"pimterry","email":"pimterry@gmail.com"}],"readme":"# Destroyable-Server [![Build Status](https://github.com/httptoolkit/destroyable-server/workflows/CI/badge.svg)](https://github.com/httptoolkit/destroyable-server/actions) [![Available on NPM](https://img.shields.io/npm/v/destroyable-server.svg)](https://npmjs.com/package/destroyable-server)\n\n> _Part of [HTTP Toolkit](https://httptoolkit.com/): powerful tools for building, testing & debugging HTTP(S)_\n\nA tiny Node.js module to make any server force-closeable.\n\nWithout this module, when you call `server.close()` it stops listening for new connections, but it doesn't close existing connections, which can stop your process from exiting or cause problems with starting new servers.\n\nWith this module, you can call `server.destroy()` to forcibly shut down all existing sockets in addition to closing the server, to immediately & completely (but cleanly) end all connections. Unlike `server.closeIdleConnections()` and similar, this is available on all net servers (not just HTTP) closes all connections with no possibility of race conditions as new connections appear, and provides a promise you can wait on to ensure all connection closure has fully completed before your code continues.\n\nThis works for HTTP, TLS, bare sockets, whatever. Anything that extends `net.Server` or follows its patterns should work correctly.\n\nUse it like so:\n\n```javascript\nconst net = require('net');\n\nconst { makeDestroyable } = require('destroyable-server');\n\n// Create a server somewhere:\nlet server = net.Server((socket) => { /* ... */ };\n\n// Make it destroyable:\nserver = makeDestroyable(server);\n\n// When you're done with it, destroy it:\nserver.destroy();\n```\n\nCalling `makeDestroyable` mutates the passed server slightly, to track all active connections, and add a `destroy()` method which ends them.\n\nCalling `destroy()` ends the connections and the server, and returns a promise, which resolves once that is complete.","readmeFilename":"README.md"}