Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
port-used
Advanced tools
Readme
A Node.js module to check if a TCP port is currently in use. It returns a promise. Based on tcp-port-used
npm install port-used
To check a port's state:
var portUsed = require('port-used');
portUsed.check(44201, '127.0.0.1')
.then((inUse) => {
console.log('Port 44201 usage: '+inUse);
}, (err) => {
console.error('Error on check:', err.message);
});
To wait until a port on a host is available:
portUsed.waitUntilFree({
port: 44203,
host: 'some.host.com',
retryTime: 500,
timeout: 4000,
}).then(() => {
console.log('Port 44203 on some.host.com is now free.');
}, (err) => {
console.log('Error:', err.message);
});
To wait until a port on a host is accepting connections:
portUsed.waitUntilUsed({
port: 44204,
host: 'some.host.com',
retryTime: 500,
timeout: 4000,
}).then(() => {
console.log('Port 44204 on some.host.com is now in use.');
}, (err) => {
console.log('Error:', err.message);
});
To wait until a port on a host is in specific state:
portUsed.waitForStatus({
port: 44204,
host: 'some.host.com',
inUse: true,
retryTime: 500,
timeout: 4000,
}).then(() => {
console.log('Port 44204 on some.host.com is now in use.');
}, (err) => {
console.log('Error:', err.message);
});
Checks if a TCP port is in use by attempting to connect to the port on host.
If no host is specified, the module uses '127.0.0.1' (localhost). When the
promise is resolved, there is a parameter inUse
, when true means the port is
in use and false means the port is free.
Parameters:
Returns:
Promise A promise.
Returns a promise and fulfills it only when the host's socket is free. Will retry on an interval specified in retryTime until the timeout. If not defined the retryTime is 250 ms and the timeout is 2000 ms. If the host is not defined, the modules uses the default '127.0.0.1'.
Parameters:
Returns:
Promise A promise.
Returns a promise and fulfills it only when the socket is accepting connections. Will retry on an interval specified in retryTime until the timeout. If not defined, the retryTime is 250 ms and the timeout is 2000 ms. If the host is not defined the module uses the default '127.0.0.1'.
Parameters:
Returns:
Promise A promise.
Waits until the port on host matches the boolean status in terms of use. If the status is true, the promise defers until the port is in use. If the status is false the promise defers until the port is free. If the host is undefined or null, the module uses the default '127.0.0.1'. Also, if not defined the retryTime is 250 ms and the timeout is 2000 ms.
Parameters:
Returns:
Promise A promise.
The MIT License (MIT)
Copyright (c) 2018 oculus42
Copyright (c) 2013 jut-io (stdarg)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A Node.js module to check if a TCP port is already bound.
The npm package port-used receives a total of 4,322 weekly downloads. As such, port-used popularity was classified as popular.
We found that port-used demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.