You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
810 B

7 years ago
  1. # node-portfinder [![Build Status](https://api.travis-ci.org/indexzero/node-portfinder.svg)](https://travis-ci.org/indexzero/node-portfinder)
  2. ## Installation
  3. ### Installing npm (node package manager)
  4. ``` bash
  5. curl http://npmjs.org/install.sh | sh
  6. ```
  7. ### Installing node-portfinder
  8. ``` bash
  9. $ [sudo] npm install portfinder
  10. ```
  11. ## Usage
  12. The `portfinder` module has a simple interface:
  13. ``` js
  14. var portfinder = require('portfinder');
  15. portfinder.getPort(function (err, port) {
  16. //
  17. // `port` is guaranteed to be a free port
  18. // in this scope.
  19. //
  20. });
  21. ```
  22. By default `portfinder` will start searching from `8000`. To change this simply set `portfinder.basePort`.
  23. ## Run Tests
  24. ``` bash
  25. $ npm test
  26. ```
  27. #### Author: [Charlie Robbins][0]
  28. #### License: MIT/X11
  29. [0]: http://nodejitsu.com