Socket
Socket
Sign inDemoInstall

can-bind-to-host

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-bind-to-host - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/index.test.d.ts

2

dist/index.d.ts

@@ -1,3 +0,3 @@

declare const canBindToHost: (host: string, port?: number) => Promise<unknown>;
declare const canBindToHost: (host: string, port?: number) => Promise<boolean>;
export default canBindToHost;
export { canBindToHost };

@@ -10,9 +10,15 @@ "use strict";

if (port === void 0) { port = 0; }
var server = null;
return new Promise(function (res) {
net_1.default.createServer(function (socket) { return socket.destroy(); }).listen({
server = net_1.default
.createServer()
.listen({
host: host,
port: 0
port: 0,
})
.addListener("error", function () { return res(false); })
.addListener("listening", function () { return res(true); });
.addListener('error', function () { return res(false); })
.addListener('listening', function () {
server === null || server === void 0 ? void 0 : server.close();
res(true);
});
});

@@ -19,0 +25,0 @@ };

{
"name": "can-bind-to-host",
"version": "1.0.0",
"version": "1.0.1",
"description": "Utility package to see if the node process can bind to the host or listen on a port. Can be used for checking if a host resolves to localhost.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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