/find-port

finds an open port

Primary LanguageJavaScriptMIT LicenseMIT

find-port Build Status

NPM NPM

find an unused port in your localhost

	var findPort = require('find-port')

	// scan a range
	findPort(8000, 8003, function(ports) {
		console.log(ports)
	})

	// scan explicitly
	findPort([8000, 8011], function(ports) {
		console.log(ports)
	})

	// find first free port in a range
	findPort(8000, 8003, true, function(port) {
    	console.log(port)
    })

    // find first free port in array
    findPort([8000, 8011], true, function(port) {
        console.log(port)
    })