{"name":"@clinic/heap-profiler","version":"5.0.0","description":"Programmable interface to Clinic.js Heap Profiler","repository":{"type":"git","url":"git+https://github.com/clinicjs/node-clinic-heap-profiler.git"},"main":"src/index.js","scripts":{"visualize-watch":"node debug/visualize-watch.js","visualize-all":"node debug/visualize-all.js","test":"npm run lint && tap","test:file":"standard | snazzy && tap --no-cov","ci-lint":"npm run lint","ci-test-cov":"tap","ci-test-no-cov":"tap --no-cov","lint":"standard --fix | snazzy"},"tap":{"nyc-arg":["--exclude=test/*.js","--exclude=visualizer/d3.js","--exclude=visualizer/data-tree.js","--exclude=visualizer/no-data-node.js"]},"author":"","license":"MIT","dependencies":{"@clinic/clinic-common":"^7.0.0","@nearform/heap-profiler":"^2.0.0","abort-controller":"^3.0.0","copy-to-clipboard":"^3.0.8","d3-array":"^2.0.2","d3-fg":"^6.13.1","d3-selection":"^1.3.2","fs-extra":"^11.0.0","lodash.debounce":"^4.0.8","on-net-listen":"1.1.2","pump":"^3.0.0","querystringify":"^2.1.0","sinusoidal-decimal":"^1.0.0"},"devDependencies":{"autocannon":"^7.5.0","chalk":"^4.1.0","chokidar":"^3.4.2","fastify":"^4.0.0","ioredis":"^5.0.1","open":"^8.4.0","snazzy":"^8.0.0","standard":"^17.0.0","tap":"^16.0.0"},"gitHead":"d18ee52a4c9d426d4bfc4d3a4615732d30f2f3a2","bugs":{"url":"https://github.com/clinicjs/node-clinic-heap-profiler/issues"},"homepage":"https://github.com/clinicjs/node-clinic-heap-profiler#readme","_id":"@clinic/heap-profiler@5.0.0","_nodeVersion":"20.3.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-1sAU3GuLk6mXGzMn6JGou6bMzP5vTpieZRgk0LVlauVDxq1+vxgiDrSO9Rn0IxHS7spMnHhOB/DigKFY6oci7Q==","shasum":"b647dd9338022fd32998265f14baf6a53ace605e","tarball":"http://registry-npm.ywwl.com/@clinic/heap-profiler/download/@clinic/heap-profiler-5.0.0.tgz","fileCount":154,"unpackedSize":333117,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiPc52HBPnX9FODQfkKl5+lVOqyqSZeCoUBcABT/GmlQIhAL7DatnVeaRDVJWu5raKbXp/XbZ3Uc23g6oUj68ajlUQ"}],"size":108494,"noattachment":false,"key":"/@clinic/heap-profiler/-/@clinic/heap-profiler-5.0.0.tgz"},"_npmUser":{"name":"rafaelgss","email":"rafael.nunu@hotmail.com"},"directories":{},"maintainers":[{"name":"jasnell","email":"jasnell@gmail.com"},{"name":"matteo.collina","email":"hello@matteocollina.com"},{"name":"simoneb","email":"simone.busoli@gmail.com"},{"name":"rafaelgss","email":"rafael.nunu@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/heap-profiler_5.0.0_1687899807433_0.7448121241670378"},"_hasShrinkwrap":false,"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](https://user-images.githubusercontent.com/26234614/143886238-481abe39-4cc7-470a-a1cd-144a73a070b9.png)\n\n## Issues\n\nTo open an issue, please use the [main repository](https://github.com/clinicjs/node-clinic) with the `heapprofiler` label.\n\n## Installation\n\n```console\nnpm i -S @clinic/heap-profiler\n```\n\n## Supported node versions\n\n- Node.js 16 and above\n\n## Example\n\n```js\nconst ClinicHeapProfiler = require('@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('@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>`][] Destination for the collected data\n    **Default**: `.clinic`\n  - name [`<String>`][] File name for the collected data\n    **Default**: `<process.pid>.clinic-heapprofiler`\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/@clinic/heap-profiler.svg?style=flat-square\n[npm-url]: https://www.npmjs.org/@clinic/heap-profiler\n[npm-downloads]: http://img.shields.io/npm/dm/@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/clinicjs/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/clinicjs/node-clinic-flame/workflows/CI/badge.svg\n[actions-url]: https://github.com/clinicjs/node-clinic-flame/actions\n","publish_time":1687899807732,"_cnpm_publish_time":1687899807732,"dist-tags":{"latest":"5.0.0"}}