Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pid-port

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pid-port - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

21

index.js

@@ -71,3 +71,9 @@ 'use strict';

module.exports = async port => {
module.exports.portToPid = async port => {
if (Array.isArray(port)) {
const list = await getList();
const tuples = await Promise.all(port.map(x => [x, getPort(x, list)]));
return new Map(tuples);
}
if (typeof port !== 'number') {

@@ -80,15 +86,4 @@ throw new TypeError(`Expected a number, got ${typeof port}`);

module.exports.all = async ports => {
if (!Array.isArray(ports)) {
throw new TypeError(`Expected an array, got ${typeof ports}`);
}
module.exports.all = async () => {
const list = await getList();
const tuples = await Promise.all(ports.map(x => [x, getPort(x, list)]));
return new Map(tuples);
};
module.exports.list = async () => {
const list = await getList();
console.log('asd', list);
const returnValue = new Map();

@@ -95,0 +90,0 @@

{
"name": "pid-port",
"version": "0.0.0",
"description": "Get the process ID for the process that uses a certain port",
"version": "0.1.0",
"description": "Get the ID of the process that uses a certain port",
"license": "MIT",
"repository": "sindresorhus/pid-port",
"funding": "https://github.com/sponsors/sindresorhus",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
},
"engines": {

@@ -20,6 +22,9 @@ "node": ">=10"

"port",
"ports",
"netstat",
"process",
"processes",
"id"
"id",
"convert",
"converter"
],

@@ -26,0 +31,0 @@ "dependencies": {

# pid-port
> Get the process ID for the process that uses a certain port
> Get the ID of the process that uses a certain port

@@ -21,3 +21,3 @@ ## Install

const pids = await pidPort.all([8080, 22]);
const pids = await pidPort.portToPid([8080, 22]);

@@ -40,2 +40,4 @@ console.log(pids.get(8080));

Returns a `Promise<number>` with the process ID.
#### port

@@ -47,3 +49,3 @@

### pidPort.all(ports)
### pidPort.portToPid(ports)

@@ -58,3 +60,3 @@ Returns a `Promise<Map<number, number>>` with the port as key and the process ID as value.

### pidPort.list()
### pidPort.all()

@@ -61,0 +63,0 @@ Get all process IDs from ports.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc