{"name":"why-is-node-running","type":"module","version":"3.2.2","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.2","gitHead":"6de8dfd78aaa548fcef1dd0cdc5b6c04f37e6d70","types":"./index.d.ts","_nodeVersion":"23.5.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-NKUzAelcoCXhXL4dJzKIwXeR8iEVqsA0Lq6Vnd0UXvgaKbzVo4ZTHROF2Jidrv+SgxOQ03fMinnNhzZATxOD3A==","shasum":"4c563f5068c5960167220f1b7102ae501cefefb9","tarball":"http://registry-npm.ywwl.com/why-is-node-running/download/why-is-node-running-3.2.2.tgz","fileCount":7,"unpackedSize":8851,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgO5mUOWrZ71ZNbOVNNDbv0wZ6h11dh2ErkG75CcT0+wIhAIxKvcaImeFCxkDeOmQPTf0wD9VqIC2I+wrdvhZ5Gx9/"}],"size":3821,"noattachment":false,"key":"/why-is-node-running/-/why-is-node-running-3.2.2.tgz"},"_npmUser":{"name":"jkoops","email":"jonkoops@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/why-is-node-running_3.2.2_1736348547791_0.6937311868525562"},"_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":1736348547953,"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"yoshuawuyts","email":"javascript@yosh.is"},{"name":"jkoops","email":"jonkoops@gmail.com"}],"_cnpm_publish_time":1736348547953,"dist-tags":{"latest":"3.2.3"}}