@fibjs/detect-port
Implementazione JavaScript di Port Detector
Installare
1$ npm i @fibjs/detect-port --save
Utilizzo
1
2const detectPort = require('@fibjs/detect-port');
const availablePort = detectPort();
O
1
2
3
4
5
6
7
8const detectPort = require('@fibjs/detect-port');
const port = 3000;
const availablePort = detectPort(port);
if (availablePort === port) {
console.log(`port ${port} is available!`);
} else {
console.log(`port ${port} is not available! Got a random available port: ${availablePort} for you.`);
}
Domande e suggerimenti
Per favore apri un problema qui .