{"_id":"@cjser/pid-port__v0_2_0","name":"@cjser/pid-port__v0_2_0","dist-tags":{"latest":"0.2.0-cjser.2"},"versions":{"0.2.0-cjser.2":{"name":"@cjser/pid-port__v0_2_0","version":"0.2.0-cjser.2","description":"Get the ID of the process that uses a certain port","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava"},"keywords":["pid","port","ports","netstat","process","processes","id","convert","converter"],"dependencies":{"execa":"^5.1.1"},"devDependencies":{"ava":"^3.15.0","get-port":"^6.0.0","xo":"^0.45.0"},"ava":{"serial":true},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"0.2.0","cjserVersion":2,"original":{"name":"pid-port","version":"0.2.0","exports":"./index.js","repository":"sindresorhus/pid-port","dependencies":{"execa":"^5.1.1"},"files":["index.js"],"scripts":{"test":"xo && ava"}}},"_id":"@cjser/pid-port__v0_2_0@0.2.0-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-h6doIyoFMOvJx8eKyqImaAjt1zFnJhsMjNPZlbHEtLlEC+Ck9NmIS/HLaM3PK5VlIc1xQoZYb7c70N/MDhxDRA==","shasum":"ca27d2c2619b4679b161dc93037473899a6d396d","tarball":"https://registry.npmjs.org/@cjser/pid-port__v0_2_0/-/pid-port__v0_2_0-0.2.0-cjser.2.tgz","fileCount":5,"unpackedSize":12055,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE8x891Ri+kCPcboxY4mStRYIyT0zYAcYobUGPessy7BAiAh5ebvoS9462UVXiyf+ZXYHjKEzK4dagae20ZvSMTVeg=="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pid-port__v0_2_0_0.2.0-cjser.2_1778159608748_0.717611150103137"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T13:13:28.694Z","0.2.0-cjser.2":"2026-05-07T13:13:28.892Z","modified":"2026-05-07T13:13:29.033Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Get the ID of the process that uses a certain port","keywords":["pid","port","ports","netstat","process","processes","id","convert","converter"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"license":"MIT","readme":"# pid-port\n\n> Get the ID of the process that uses a certain port\n\n## Install\n\n```sh\nnpm install pid-port\n```\n\n## Usage\n\n```js\nimport {portToPid} from 'pid-port';\n\ntry {\n\tconsole.log(await portToPid(8080));\n\t//=> 1337\n\n\tconst pids = await portToPid([8080, 22]);\n\n\tconsole.log(pids.get(8080));\n\t//=> 1337\n\n\tconsole.log(pids.get(22));\n\t//=> 12345\n} catch (error) {\n\tconsole.log(error);\n\t//=> 'Could not find a process that uses port `8080`'\n}\n```\n\n## API\n\n### portToPid(port)\n\nReturns a `Promise<number>` *(integer)* with the process ID.\n\n#### port\n\nType: `number` *(integer)*\n\nThe port to look up.\n\n### portToPid(ports)\n\nReturns a `Promise<Map<number, number>>` *(integer)* with the port as key and the process ID as value.\n\n#### ports\n\nType: `number[]` *(integer)*\n\nThe ports to look up.\n\n### pidToPorts(pid)\n\nReturns a `Promise<Set<number>>` with the ports.\n\n#### pid\n\nType: `number`\n\nThe process ID to look up.\n\n### pidToPorts(pids)\n\nReturns a `Promise<Map<number, Set<number>>>` with the process ID as the key and the ports as value.\n\n#### pids\n\nType: `number[]`\n\nThe process IDs to look up.\n\n### allPortsWithPid()\n\nGet all ports with their process ID.\n\nReturns a `Promise<Map<number, number>>` *(integer)* with the port as key and the process ID as value.\n\n## Related\n\n- [fkill-cli](https://github.com/sindresorhus/fkill-cli) - Uses this package to let you kill the process that occupies a certain port\n- [pid-cwd](https://github.com/neeksandhu/pid-cwd) - Find the working directory of a process from its process ID\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/pid-port\n","readmeFilename":"readme.md","_rev":"1-53fdb8e9f588a886b6debfa49d89a9c7"}