{"_id":"node-clinic-heap-profiler","_rev":"1763082","name":"node-clinic-heap-profiler","description":"Programmable interface to Clinic.js Heap Profiler","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"jasnell","email":"jasnell@gmail.com"}],"time":{"modified":"2026-11-28T01:02:30.000Z","created":"2021-05-13T22:52:06.989Z","1.0.0":"2021-05-13T22:52:06.989Z"},"users":{},"author":"","repository":{"url":"git+https://github.com/clinicjs/node-clinic-heap-profiler.git","type":"git"},"versions":{"1.0.0":{"name":"node-clinic-heap-profiler","version":"1.0.0","author":"","license":"MIT","_id":"node-clinic-heap-profiler@1.0.0","maintainers":[{"name":"jasnell","email":"jasnell@gmail.com"}],"homepage":"https://github.com/clinicjs/node-clinic-heap-profiler#readme","bugs":{"url":"https://github.com/clinicjs/node-clinic-heap-profiler/issues"},"tap":{"nyc-arg":["--exclude=test/*.js","--exclude=visualizer/d3.js","--exclude=visualizer/data-tree.js","--exclude=visualizer/no-data-node.js"]},"dist":{"shasum":"2f66b26069139ca85290f2d529e83f25fa298254","tarball":"http://registry-npm.ywwl.com/node-clinic-heap-profiler/download/node-clinic-heap-profiler-1.0.0.tgz","fileCount":150,"integrity":"sha512-MwUKAoc6pr93PTkKR0HjtE9ryyXqb7bwxWaZ7PiN2PJHvSH08f9oORLznBVp/JvF0+tt3p2Otu0KW+TeyG5sBQ==","signatures":[{"sig":"MEUCIQD42izwEfxgctkOiRAYyZFSzbBr6wVyfSxQNwyylsf5+gIgCELgvMZVEZKAWalltjgCIjC6qgN9OLZ/1sV8aJhX2rw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":304051,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2030CRA9TVsSAnZWagAA3LAP/1cr3aN06NflA1I8vr22\naN4txX7Z5SPxm6LkNqrght09hoseL39VXyRqEKNN7h+DxzldL9j89ajxEGxp\nLjinG4aj3sy1wUN7wo0OES4JvK2wrJzmgrCRqrhIcy//5YOc7XR2IRbHyZYL\nFbykb5xU/pmNUwiucaY/ZTQoH+C9fs41/+P1D6Dhr9jcXjhnq1MEkIwa+R4V\nbb9SBxqe5tM+i5VOU0z6LRSjEqiUwOmn/IFkbyFZtrffGSRffI+4euDfFWYP\nNXoPj6TIfEw+RJz4B9NtRACtmu+D3IFOBCKCSuBch1C3pQe/dRT2wpG1M+Dt\n4Fdcxl5z9jTY2ZUL9MACxzyFRWQu8uvJ+Q6MeF6xKpIQ1APFfJJZ2MxNwvSr\nXJ9FHliWszEoIYLXgZrTqBM3zBQ0jLxcTgTcJG7ojdqcUbQLfrHMeQXM7DsL\npLYHfsPBAT+Z+AicjfRZORvAUO1cyvfm6iP0nZQFcLIwQFAhIhzCXcgbnK6d\nrzczyaz9E3vfQ241CFxCKLfJxNzByiPWU2uQdX4aD6flrZ9YJ2I2L+baAX1i\nkB5tDNxToqdEHvc3kSdN9kQCuIzeQOXoQG77nHJnYvxCdu1dtuTw1A/LBKyU\nx+DkZ0Ib1NnaeAjeE2wglGnpG/O+KXA6ME+mLeyr78m4epZ1NuZyocRwrgS8\nuHuX\r\n=9oXb\r\n-----END PGP SIGNATURE-----\r\n","size":101320,"noattachment":false,"key":"/node-clinic-heap-profiler/-/node-clinic-heap-profiler-1.0.0.tgz"},"main":"src/index.js","engines":{"node":">= 12.13.0"},"gitHead":"9d9a643c41ff9b334479c96de8497ed2edcde6bd","scripts":{"lint":"standard --fix | snazzy","test":"npm run lint && tap","ci-lint":"npm run lint","test:file":"standard | snazzy && tap --no-cov","ci-test-cov":"tap","visualize-all":"node debug/visualize-all.js","ci-test-no-cov":"tap --no-cov","visualize-watch":"node debug/visualize-watch.js"},"_npmUser":{"name":"jasnell","email":"jasnell@gmail.com"},"repository":{"url":"git+https://github.com/clinicjs/node-clinic-heap-profiler.git","type":"git"},"_npmVersion":"7.11.2","description":"Programmable interface to Clinic.js Heap Profiler","directories":{},"_nodeVersion":"16.1.0","dependencies":{"pump":"^3.0.0","d3-fg":"^6.13.1","d3-array":"^2.0.2","fs-extra":"^9.0.1","d3-selection":"^1.3.2","on-net-listen":"1.1.2","querystringify":"^2.1.0","lodash.debounce":"^4.0.8","abort-controller":"^3.0.0","copy-to-clipboard":"^3.0.8","sinusoidal-decimal":"^1.0.0","@nearform/clinic-common":"^6.0.0","@nearform/heap-profiler":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^14.10.6","open":"^7.3.0","chalk":"^4.1.0","snazzy":"^8.0.0","fastify":"^3.7.0","ioredis":"^4.17.3","chokidar":"^3.4.2","standard":"^14.3.1","autocannon":"^6.5.0"},"_npmOperationalInternal":{"tmp":"tmp/node-clinic-heap-profiler_1.0.0_1620946326877_0.40070154166059235","host":"s3://npm-registry-packages"},"publish_time":1620946326989,"_cnpm_publish_time":1620946326989}},"readme":"# Clinic.js Heap Profiler\n\n[![npm version][npm-version]][npm-url] [![Stability Stable][stability-stable]][stability-docs] [![Github Actions build status][actions-status]][actions-url]\n[![Downloads][npm-downloads]][npm-url] [![Code style][lint-standard]][lint-standard-url]\n\nProgrammable interface to [Clinic.js][clinic-url] Heap Profiler. Learn more about Clinic.js: https://clinicjs.org/\n\n![Screenshot](screenshot.png)\n\n## Supported node versions\n\n- Node.js 10 and above\n\n## Example\n\n```js\nconst ClinicHeapProfiler = require('@nearform/clinic-heap-profiler')\nconst heapProfiler = new ClinicHeapProfiler()\n\nheapProfiler.collect(['node', './path-to-script.js'], function (err, filepath) {\n  if (err) throw err\n\n  heapProfiler.visualize(filepath, filepath + '.html', function (err) {\n    if (err) throw err\n  })\n})\n```\n\n## Documentation\n\n```js\nconst ClinicHeapProfiler = require('@nearform/clinic-heap-profiler')\nconst heapProfiler = new ClinicHeapProfiler()\n```\n\n### new ClinicHeapProfiler([settings])\n\n- settings [`<Object>`][]\n  - detectPort [`<boolean>`][] **Default**: false\n  - collectOnFailure [`<boolean>`][] If set to true, the collected data will be returned even if the process exits with non-zero code.\n    **Default**: false\n  - debug [`<boolean>`][] If set to true, the generated html will not be minified.\n    **Default**: false\n  - dest [`<String>`][] The file where the collected data is stored.\n    **Default**: `./.clinic/<process.pid>.clinic-heapprofile`\n\n#### `heapProfiler.collect(args, callback)`\n\nStarts a process by using [@nearform/heap-profiler](https://github.com/nearform/heap-profiler).\n\nThe process sampling is started as soon as the process starts. The filepath with collected data will be the value in the callback.\n\n`stdout`, `stderr`, and `stdin` will be relayed to the calling process.\n\nThe sampling is stopped and data collected right before the process exits.\n\nIf you want to collect data earlier, you can send the process a `SIGINT` or, if `detectPort` is `true`, you can call `heapProfiler.stopViaIPC()`.\n\n#### `heapProfiler.visualize(dataFilename, outputFilename, callback)`\n\nWill consume the datafile specified by `dataFilename`, this datafile will be\nproduced by the sampler using `heapProfiler.collect`.\n\n`heapProfiler.visualize` will then output a standalone HTML file to `outputFilename`.\nWhen completed the `callback` will be called with no extra arguments, except a\npossible error.\n\n#### `heapProfiler.stopViaIPC()`\n\nWhen the profiler is started with `detectPort=true`, the profiler establish a TCP based IPC communication.\n\nThis method can therefore be called to collect the data at any time.\n\nIf no TCP channel is opened or available, the method will perform no operation so it is safe to call at all times.\n\n## Examples\n\nSee the `examples` folder. All example should be run from the repository main folder:\n\n```sh\nnode examples/redis-web-service\n```\n\nEach `index.js` will contain any specific setup step required by the example, if any.\n\n## License\n\n[MIT](LICENSE)\n\n[stability-stable]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square\n[stability-docs]: https://nodejs.org/api/documentation.html#documentation_stability_index\n[npm-version]: https://img.shields.io/npm/v/@nearform/clinic-heap-profiler.svg?style=flat-square\n[npm-url]: https://www.npmjs.org/@nearform/clinic-heap-profiler\n[npm-downloads]: http://img.shields.io/npm/dm/@nearform/clinic-heap-profiler.svg?style=flat-square\n[lint-standard]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[lint-standard-url]: https://github.com/feross/standard\n[clinic-url]: https://github.com/nearform/node-clinic\n[`<object>`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object\n[`<number>`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number\n[`<boolean>`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type\n[`<string>`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String\n[actions-status]: https://github.com/nearform/node-clinic-flame/workflows/CI/badge.svg\n[actions-url]: https://github.com/nearform/node-clinic-flame/actions\n","_attachments":{},"homepage":"https://github.com/clinicjs/node-clinic-heap-profiler#readme","bugs":{"url":"https://github.com/clinicjs/node-clinic-heap-profiler/issues"},"license":"MIT"}