New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details → →
Socket
Book a DemoSign in
Socket

eport

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

eport

Get a free port.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

eport Build Status

Find a free port

Install

Install this package with npm, if you have not install NodeJs or npm, you should install that first.

   npm install eport --save-dev

Just run this commands to install eport for your project.

Usage

  var eport = require('eport');
  eport([host], function(error, port) {
    // do something with the port.
  });

Method

require('eport')([host], callback);

  • [host] A hostname or ip address that it will listen to.
  • callback(error, port) A hostname or ip address that it will listen to.
    • callback.error object throws error
    • callback.port number a free port.

Example 1

eport("127.0.0.1", function(error, port) {
  if (!error) {
    // Now listening to the port of second arguments
  }
});

// without host
eport(function(error, port) {
  // ...
});

Example 2


 // Set a random port for livereload;
  grunt.registerTask('setServerPort', function() {
    var eport = require('eport');
    var done = this.async();

    // grunt server port;
    eport(function(error, port) {
      if (!error) {
        grunt.config.set('connect.options.livereload', port);
      } else {
        grunt.log.error(error);
      }
      done();
    });
  });

Keywords

free

FAQs

Package last updated on 05 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts