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

public-address

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

public-address - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.npmignore

37

index.js

@@ -1,8 +0,8 @@

"use strict";
'use strict';
var http = require("http");
var http = require('http');
module.exports = resolve;
function resolve(options, callback){
function resolve(options, callback) {
var requestOptions = {

@@ -15,3 +15,3 @@ hostname: 'www.remoteaddress.net',

if(!callback && typeof options == "function"){
if (!callback && typeof options == 'function') {
callback = options;

@@ -22,3 +22,3 @@ options = undefined;

options = options || {};
Object.keys(options).forEach(function(key){
Object.keys(options).forEach(function(key) {
requestOptions[key] = options[key];

@@ -28,8 +28,9 @@ });

http.get(requestOptions, function(res) {
var chunks = [], chunklen = 0;
var chunks = [],
chunklen = 0;
if(res.statusCode != 200){
res.on("data", function(){});
res.on("end", function(){
callback(new Error("Invalid response code " + res.statusCode));
if (res.statusCode != 200) {
res.on('data', function() {});
res.on('end', function() {
callback(new Error('Invalid response code ' + res.statusCode));
});

@@ -39,3 +40,3 @@ return;

res.on("data", function(chunk){
res.on('data', function(chunk) {
chunks.push(chunk);

@@ -45,10 +46,10 @@ chunklen += chunk.length;

res.on("end", function(){
res.on('end', function() {
var data;
try{
try {
data = JSON.parse(Buffer.concat(chunks, chunklen).toString());
}catch(exception){}
if(!data){
callback(new Error("Invalid response from server"));
}else{
} catch (exception) {}
if (!data) {
callback(new Error('Invalid response from server'));
} else {
callback(null, data);

@@ -60,2 +61,2 @@ }

});
}
}
{
"name": "public-address",
"version": "0.1.0",
"version": "0.1.1",
"description": "Resolve public IP address and hostname",

@@ -5,0 +5,0 @@ "main": "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