diff --git a/lib/portfinder.d.ts b/lib/portfinder.d.ts index a57b999..0ed29ba 100644 --- a/lib/portfinder.d.ts +++ b/lib/portfinder.d.ts @@ -60,3 +60,13 @@ export function getPorts(count: number, options: PortFinderOptions, callback: (e * Responds a promise of an unbound port on the current machine. */ export function getPortPromise(options?: PortFinderOptions): Promise; + +/** + * Default path to begin any socket search from. + */ + export let basePath: string; + +/** + * Set the base path to begin any socket search from. + */ +export function setBasePath(path: string): void; diff --git a/lib/portfinder.js b/lib/portfinder.js index 2bc65e2..d8d3595 100644 --- a/lib/portfinder.js +++ b/lib/portfinder.js @@ -115,6 +115,13 @@ exports.setHighestPort = function (port) { exports.basePath = '/tmp/portfinder' // +// ### function setBasePath (path) +// #### @path {String} The new base path +// +exports.setBasePath = function (path) { + exports.basePath = path; +} + // ### function getPort (options, callback) // #### @options {Object} Settings to use when finding the necessary port // #### @callback {function} Continuation to respond to when complete.