{"_id":"@bun-win32/pdh","_rev":"7-3372dbc85bb2f5f398deb4dcec83c7e8","name":"@bun-win32/pdh","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/pdh","version":"1.0.0","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"author":{"name":"Stev Peifer","email":"stev@bell.net"},"license":"MIT","_id":"@bun-win32/pdh@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"34758ab1bea8548612e01a95dfff61bfa718caef","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-1.0.0.tgz","fileCount":5,"integrity":"sha512-EH6r0YYH8gaNossf83MOAo2cWejUgpaDS0qxPG7rGpYjcYKUZEdOc0daNexJSzuUL8CBhREKu66FVl/a7Afnjw==","signatures":[{"sig":"MEYCIQDKFaaOs8b4VvGkKDMrxaLRSJ8ZNlcxcRU9Gcejfve0BAIhAKPUc7PyKQ4x0mJFOPOejYmlDh+vL+Zu2fW5juyzCA1i","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":49468},"main":"./index.ts","type":"module","module":"index.ts","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"gitHead":"69496884462076c066e6cd5bb2af075423abee5e","private":false,"scripts":{"example":"bun ./example/pdh.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/pdh"},"_npmVersion":"10.1.0","description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"20.8.0","dependencies":{"@bun-win32/core":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/pdh_1.0.0_1775506286240_0.7055647493264681","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/pdh","version":"1.0.1","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/pdh@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"a316aa18660a90ffd36d553e793816c4467efcac","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-1.0.1.tgz","fileCount":6,"integrity":"sha512-PKX7SlIVMTSeFjVjedVsgliMynxoIJMHicj9Phx8XrdAz58LnfQkwY2MW0Vykevz/rjY2bWpejGz5eNp5ezFLA==","signatures":[{"sig":"MEUCIGmHQ/IDTQrOTkKdYoa8PLfCdr6c+zk5tIqWtuHw2ZL0AiEA7MDJ/FzUlNbGVqm4Y7wyFkm/hm3Rl9zGistKk3a+G6o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51661},"main":"./index.ts","type":"module","module":"index.ts","shasum":"a316aa18660a90ffd36d553e793816c4467efcac","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example":"bun ./example/pdh.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-PKX7SlIVMTSeFjVjedVsgliMynxoIJMHicj9Phx8XrdAz58LnfQkwY2MW0Vykevz/rjY2bWpejGz5eNp5ezFLA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/pdh"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/pdh_1.0.1_1775514762253_0.513408934921384","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bun-win32/pdh","version":"1.0.2","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"author":{"name":"Stev Peifer","email":"stev@bell.net"},"license":"MIT","_id":"@bun-win32/pdh@1.0.2","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"a22808ca7f51a1bc2d57e752102529145beae7b0","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-1.0.2.tgz","fileCount":6,"integrity":"sha512-4U2JJplPXkxNrUaQGEDNs+bb8V0ODFoBvKeiHd0LGM3NKPmN+TvkoVDkRq6AgBHnY/XzxD6m197joAhOGZUbQQ==","signatures":[{"sig":"MEUCIQCvcwmF9wEhj8el55uFknoSMrXMqLpNh8N73QplMNgJZQIgSeaSFS+KicDJkUPi2kmrJJk5hcBunAeDeQEBCSjENuU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52004},"main":"./index.ts","type":"module","module":"index.ts","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"gitHead":"f86f0df557aa6cfee8907bf3af5592855a854c15","private":false,"scripts":{"example":"bun ./example/pdh.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/pdh"},"_npmVersion":"10.1.0","description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"20.8.0","dependencies":{"@bun-win32/core":"workspace:*"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/pdh_1.0.2_1775584512792_0.020566010138771018","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bun-win32/pdh","version":"1.0.3","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/pdh@1.0.3","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"b644bf98e94356682d3d565367f4427e1eec7695","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-1.0.3.tgz","fileCount":6,"integrity":"sha512-ueyY6LBI2o4yqGh3Vv1skq/ZGK14/e+vQiZqP7XEHmxHlzR0DHhzFQLgkxq62yP4V4Eqyt3njjt1aa4GSSTCOA==","signatures":[{"sig":"MEUCIQC8dtwOZadxfz4T0CN13CHYnlN3Gh1cH3pNOzk7sLPEogIgHXo6FnneUOfu38EWnPLWlOD8txbnVyJzegi+zkVHS2k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52036},"main":"./index.ts","type":"module","module":"index.ts","shasum":"b644bf98e94356682d3d565367f4427e1eec7695","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example":"bun ./example/pdh.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-ueyY6LBI2o4yqGh3Vv1skq/ZGK14/e+vQiZqP7XEHmxHlzR0DHhzFQLgkxq62yP4V4Eqyt3njjt1aa4GSSTCOA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/pdh"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/pdh_1.0.3_1775616192820_0.24771436834767524","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@bun-win32/pdh","version":"1.0.4","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/pdh@1.0.4","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"d5dd5653fdf8463ea82a8783fe00d578c4ce17f6","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-1.0.4.tgz","fileCount":6,"integrity":"sha512-xuR0Q2R3SoZtCSD0ii/wayWO0tU4LWmIK5tJ0pm3iuR7hWRb423QPOqkzaSv4pOQq1PlStLB788w8S0BKCz7CA==","signatures":[{"sig":"MEQCICDQKHAbo3JzyEuOzVXSVsE26hH7O3kGrcyuJ5A1oNeAAiAQ2Zo0c2SAYHD6IKc3XWRs12cAUu+xNm2+ShcDTGSF8Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52223},"main":"./index.ts","type":"module","module":"index.ts","shasum":"d5dd5653fdf8463ea82a8783fe00d578c4ce17f6","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:live-dashboard":"bun ./example/live-dashboard.ts","example:counter-explorer":"bun ./example/counter-explorer.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-xuR0Q2R3SoZtCSD0ii/wayWO0tU4LWmIK5tJ0pm3iuR7hWRb423QPOqkzaSv4pOQq1PlStLB788w8S0BKCz7CA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/pdh"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/pdh_1.0.4_1775687618913_0.551081054519859","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/pdh","version":"2.0.0","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/pdh@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"6ad1bbc8def88be40339bb81c281fe02c7a96273","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-2.0.0.tgz","fileCount":6,"integrity":"sha512-+MU8F3P7baS/iEo8l7HyMwrhOdHkVoxz/BAEQbibmcRYi/K6XwaxbW9yAT9q5z6L57ub9N7FyBavL/8KaDcx+Q==","signatures":[{"sig":"MEUCIQDOCgnfVx9SHRfsjK6xVlY/hPEF1hCqVpDytzAV5jvtlwIgY8oCbqyDJA8jJQUZ1hvQmB2NWyBqz/mY8ngQGL5OGig=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55512},"main":"./index.ts","type":"module","module":"index.ts","shasum":"6ad1bbc8def88be40339bb81c281fe02c7a96273","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:live-dashboard":"bun ./example/live-dashboard.ts","example:counter-explorer":"bun ./example/counter-explorer.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-+MU8F3P7baS/iEo8l7HyMwrhOdHkVoxz/BAEQbibmcRYi/K6XwaxbW9yAT9q5z6L57ub9N7FyBavL/8KaDcx+Q==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/pdh"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/pdh_2.0.0_1782435489887_0.038529642180936685","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/pdh","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/pdh"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:live-dashboard":"bun ./example/live-dashboard.ts","example:counter-explorer":"bun ./example/counter-explorer.ts"},"_id":"@bun-win32/pdh@2.0.1","_integrity":"sha512-1ney9hSaybdUlRYzZQAVTO/e3rhxKUPaydbnByCE6panJbAXULIdRbmkKdGZ8fHTGWl63jqJzEQBBXX0sHE1kw==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"0aab663e57571323314c2efbf9f1465321c5f8f6","dist":{"integrity":"sha512-1ney9hSaybdUlRYzZQAVTO/e3rhxKUPaydbnByCE6panJbAXULIdRbmkKdGZ8fHTGWl63jqJzEQBBXX0sHE1kw==","shasum":"0aab663e57571323314c2efbf9f1465321c5f8f6","tarball":"https://registry.npmjs.org/@bun-win32/pdh/-/pdh-2.0.1.tgz","fileCount":6,"unpackedSize":55512,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQChXc1628UYkjgK1DYDsHiYevGpRw6smnODnqf3s0IvvgIhANHGMOsm/9HJiOhkAL8nh63LBor3sU+08sQab9MGeK+H"}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pdh_2.0.1_1782438149971_0.7249231344853657"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-06T20:11:26.025Z","modified":"2026-06-26T01:42:30.279Z","1.0.0":"2026-04-06T20:11:26.407Z","1.0.1":"2026-04-06T22:32:42.431Z","1.0.2":"2026-04-07T17:55:12.982Z","1.0.3":"2026-04-08T02:43:13.048Z","1.0.4":"2026-04-08T22:33:39.102Z","2.0.0":"2026-06-26T00:58:10.046Z","2.0.1":"2026-06-26T01:42:30.154Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","pdh","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/pdh"},"description":"Zero-dependency, zero-overhead Win32 PDH bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/pdh\r\n\r\nZero-dependency, zero-overhead Win32 PDH bindings for [Bun](https://bun.sh) on Windows.\r\n\r\n## Overview\r\n\r\n`@bun-win32/pdh` exposes the `pdh.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Pdh`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\r\n\r\nThe bindings are strongly typed for a smooth DX in TypeScript.\r\n\r\n## Features\r\n\r\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\r\n- Direct FFI to `pdh.dll` (performance counter queries, logs, formatting, enumeration, and more).\r\n- In-source docs in `structs/Pdh.ts` with links to Microsoft Docs.\r\n- Lazy binding on first call; optional eager preload (`Pdh.Preload()`).\r\n- No wrapper overhead; calls map 1:1 to native APIs.\r\n- Strongly-typed Win32 aliases (see `types/Pdh.ts`).\r\n\r\n## Requirements\r\n\r\n- [Bun](https://bun.sh) runtime\r\n- Windows 10 or later\r\n\r\n## Installation\r\n\r\n```sh\r\nbun add @bun-win32/pdh\r\n```\r\n\r\n## Quick Start\r\n\r\n```ts\r\nimport Pdh from '@bun-win32/pdh';\r\n\r\n// Optionally bind a subset up-front\r\nPdh.Preload(['PdhOpenQueryW', 'PdhAddEnglishCounterW', 'PdhCollectQueryData', 'PdhGetFormattedCounterValue', 'PdhCloseQuery']);\r\n\r\n// Open a real-time query\r\nconst hQuery = Buffer.alloc(8);\r\nPdh.PdhOpenQueryW(null, 0n, hQuery.ptr);\r\nconst query = hQuery.readBigUInt64LE(0);\r\n\r\n// Add a CPU usage counter (English, locale-independent)\r\nconst hCounter = Buffer.alloc(8);\r\nconst counterPath = Buffer.from('\\\\Processor(_Total)\\\\% Processor Time\\0', 'utf16le');\r\nPdh.PdhAddEnglishCounterW(query, counterPath.ptr, 0n, hCounter.ptr);\r\nconst counter = hCounter.readBigUInt64LE(0);\r\n\r\n// Collect and format\r\nPdh.PdhCollectQueryData(query);\r\n\r\nconst value = Buffer.alloc(24); // PDH_FMT_COUNTERVALUE\r\nPdh.PdhGetFormattedCounterValue(counter, 0x0000_0200, null, value.ptr); // PDH_FMT_DOUBLE\r\nconsole.log('CPU: %.1f%%', value.readDoubleLE(8));\r\n\r\nPdh.PdhCloseQuery(query);\r\n```\r\n\r\n> [!NOTE]\r\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\r\n\r\n## Examples\r\n\r\nRun the included examples:\r\n\r\n```sh\r\nbun run example              # Performance counter query\r\n```\r\n\r\n## Notes\r\n\r\n- Either rely on lazy binding or call `Pdh.Preload()`.\r\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}