{"name":"why-is-node-running","type":"module","version":"3.2.1","description":"Node is running but you don't know why? why-is-node-running is here to help you.","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./include":"./include.js"},"bin":{"why-is-node-running":"cli.js"},"engines":{"node":">=20.11"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/why-is-node-running.git"},"keywords":["debug","devops","test","events","handles"],"author":{"name":"Mathias Buus","url":"@mafintosh"},"contributors":[{"name":"Jon Peck","email":"jpeck@fluxsauce.com"}],"license":"MIT","bugs":{"url":"https://github.com/mafintosh/why-is-node-running/issues"},"homepage":"https://github.com/mafintosh/why-is-node-running","_id":"why-is-node-running@3.2.1","gitHead":"35e08215151fc8254d8e1397e25beece4907dfb7","types":"./index.d.ts","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==","shasum":"f66f0d61f861e4d3965a7ad63645a953f550830c","tarball":"http://registry-npm.ywwl.com/why-is-node-running/download/why-is-node-running-3.2.1.tgz","fileCount":7,"unpackedSize":8564,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/why-is-node-running@3.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCucuAsjXEuisOncp6M8GGLfLAVs+3ESNFkW9S2diz9zgIgR+Icfb6ioukEdJ3hV6O95OqEhodevNTr01F0xGuDxg4="}],"size":3722,"noattachment":false,"key":"/why-is-node-running/-/why-is-node-running-3.2.1.tgz"},"_npmUser":{"name":"jkoops","email":"jonkoops@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/why-is-node-running_3.2.1_1730221728181_0.12992851064332278"},"_hasShrinkwrap":false,"readme":"# why-is-node-running\n\nNode.js is running but you don't know why? `why-is-node-running` is here to help you.\n\n## Installation\n\nIf you want to use `why-is-node-running` in your code, you can install it as a local dependency of your project. If you want to use it as a CLI, you can install it globally, or use `npx` to run it without installing it.\n\n### As a local dependency\n\nNode.js 20.11 and above (ECMAScript modules):\n\n```bash\nnpm install --save-dev why-is-node-running\n```\n\nNode.js 8 or higher (CommonJS):\n\n```bash\nnpm install --save-dev why-is-node-running@v2.x\n```\n\n### As a global package\n\n```bash\nnpm install --global why-is-node-running\nwhy-is-node-running /path/to/some/file.js\n```\n\nAlternatively if you do not want to install the package globally, you can run it with [`npx`](https://docs.npmjs.com/cli/commands/npx):\n\n```bash\nnpx why-is-node-running /path/to/some/file.js\n```\n\n## Usage (as a dependency)\n\n```js\nimport whyIsNodeRunning from 'why-is-node-running' // should be your first import\nimport { createServer } from 'node:net'\n\nfunction startServer () {\n  const server = createServer()\n  setInterval(() => {}, 1000)\n  server.listen(0)\n}\n\nstartServer()\nstartServer()\n\n// logs out active handles that are keeping node running\nsetImmediate(() => whyIsNodeRunning())\n```\n\nSave the file as `example.js`, then execute:\n\n```bash\nnode ./example.js\n```\n\nHere's the output:\n\n```\nThere are 4 handle(s) keeping the process running\n\n# Timeout\nexample.js:6  - setInterval(() => {}, 1000)\nexample.js:10 - startServer()\n\n# TCPSERVERWRAP\nexample.js:7  - server.listen(0)\nexample.js:10 - startServer()\n\n# Timeout\nexample.js:6  - setInterval(() => {}, 1000)\nexample.js:11 - startServer()\n\n# TCPSERVERWRAP\nexample.js:7  - server.listen(0)\nexample.js:11 - startServer()\n```\n\n## Usage (as a CLI)\n\nYou can run `why-is-node-running` as a standalone if you don't want to include it inside your code. Sending `SIGUSR1`/`SIGINFO` signal to the process will produce the log. (`Ctrl + T` on macOS and BSD systems)\n\n```bash\nwhy-is-node-running /path/to/some/file.js\n```\n\n```\nprobing module /path/to/some/file.js\nkill -SIGUSR1 31115 for logging\n```\n\nTo trigger the log:\n\n```\nkill -SIGUSR1 31115\n```\n\n## Usage (with Node.js' `--import` option)\n\nYou can also use Node's [`--import`](https://nodejs.org/api/cli.html#--importmodule) option to preload `why-is-node-running`:\n\n```bash\nnode --import why-is-node-running/include /path/to/some/file.js\n```\n\nThe steps are otherwise the same as the above CLI section\n\n## License\n\nMIT\n","publish_time":1730221728344,"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"yoshuawuyts","email":"javascript@yosh.is"},{"name":"jkoops","email":"jonkoops@gmail.com"}],"_cnpm_publish_time":1730221728344,"dist-tags":{"latest":"3.2.3"}}