{"_id":"why-is-node-running@3.2.3","bin":{"why-is-node-running":"cli.js"},"bugs":{"url":"https://github.com/mafintosh/why-is-node-running/issues"},"dist":{"shasum":"17e74ade51de43b018e006fdf2b5ccbfc8100d05","tarball":"http://registry-npm.ywwl.com/why-is-node-running/download/why-is-node-running-3.2.3.tgz","integrity":"sha512-b+aWTM7Zz5Q82TurMbr034vAmyJo2pJFVXzUzuhJK8lP+XI6xUfvzXizZINaERhH3KwybDLt6iqh7pOXaVxjnQ==","fileCount":7,"unpackedSize":8973,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/why-is-node-running@3.2.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICSU+13T3jCXXhVjH2s49YlHHgZh94Hnh+GkZ6Qxpk8MAiBmVOyL93YgscEezQaeV44GfIq6wChlFP1WMuLr1x6phw=="}],"size":3865,"noattachment":false,"key":"/why-is-node-running/-/why-is-node-running-3.2.3.tgz"},"name":"why-is-node-running","type":"module","types":"./index.d.ts","author":{"url":"@mafintosh","name":"Mathias Buus"},"engines":{"node":">=20.11"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./include":"./include.js"},"gitHead":"7e76fc62e8f419abcd00a5525af2869a239e04bf","license":"MIT","version":"3.2.3","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"ab47a1b4-c8a5-4747-af88-eab29415197c"},"approver":{"name":"jkoops","email":"jonkoops@gmail.com"}},"homepage":"https://github.com/mafintosh/why-is-node-running","keywords":["debug","devops","test","events","handles"],"devEngines":{"runtime":{"name":"node","onFail":"download","version":"26"}},"repository":{"url":"git+https://github.com/mafintosh/why-is-node-running.git","type":"git"},"_npmVersion":"11.20.0","description":"Node is running but you don't know why? why-is-node-running is here to help you.","directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"jkoops","email":"jonkoops@gmail.com"}],"_nodeVersion":"26.11.1","contributors":[{"name":"Jon Peck","email":"jpeck@fluxsauce.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/why-is-node-running_3.2.3_1791544772378_0.3814476447671298"},"_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":1791544772467,"_cnpm_publish_time":1791544772467,"dist-tags":{"latest":"3.2.3"}}