portfinder
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -11,2 +11,3 @@ /* | ||
path = require('path'), | ||
async = require('async'), | ||
mkdirp = require('mkdirp').mkdirp; | ||
@@ -72,2 +73,32 @@ | ||
// | ||
// ### function getPorts (count, options, callback) | ||
// #### @count {Number} The number of ports to find | ||
// #### @options {Object} Settings to use when finding the necessary port | ||
// #### @callback {function} Continuation to respond to when complete. | ||
// Responds with an array of unbound ports on the current machine. | ||
// | ||
exports.getPorts = function (count, options, callback) { | ||
if (!callback) { | ||
callback = options; | ||
options = {}; | ||
} | ||
var lastPort = null; | ||
async.timesSeries(count, function(index, asyncCallback) { | ||
if (lastPort) { | ||
options.port = exports.nextPort(lastPort); | ||
} | ||
exports.getPort(options, function (err, port) { | ||
if (err) { | ||
asyncCallback(err); | ||
} else { | ||
lastPort = port; | ||
asyncCallback(null, port); | ||
} | ||
}); | ||
}, callback); | ||
}; | ||
// | ||
// ### function getSocket (options, callback) | ||
@@ -74,0 +105,0 @@ // #### @options {Object} Settings to use when finding the necessary port |
{ | ||
"name": "portfinder", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A simple tool to find an open port on the current machine", | ||
@@ -12,12 +12,12 @@ "author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
"dependencies": { | ||
"mkdirp": "0.0.x" | ||
"async": "0.9.0", | ||
"mkdirp": "0.5.x" | ||
}, | ||
"devDependencies": { | ||
"async": "0.1.x", | ||
"vows": "0.5.x" | ||
"vows": "0.8.0" | ||
}, | ||
"main": "./lib/portfinder", | ||
"scripts": { "test": "vows test/*-test.js --spec" }, | ||
"engines": { "node": ">= 0.4.0" }, | ||
"engines": { "node": ">= 0.8.0" }, | ||
"license": "MIT/X11" | ||
} |
@@ -1,2 +0,2 @@ | ||
# node-portfinder | ||
# node-portfinder [![Build Status](https://api.travis-ci.org/indexzero/node-portfinder.svg)](https://travis-ci.org/indexzero/node-portfinder) | ||
@@ -20,6 +20,6 @@ ## Installation | ||
var portfinder = require('portfinder'); | ||
portfinder.getPort(function (err, port) { | ||
// | ||
// `port` is guarenteed to be a free port | ||
// `port` is guaranteed to be a free port | ||
// in this scope. | ||
@@ -39,2 +39,2 @@ // | ||
#### License: MIT/X11 | ||
[0]: http://nodejitsu.com | ||
[0]: http://nodejitsu.com |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14313
1
10
397
39
2
5
+ Addedasync@0.9.0
+ Addedasync@0.9.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
- Removedmkdirp@0.0.7(transitive)
Updatedmkdirp@0.5.x