node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »


port-drop Build status for port-drop on Circle CI.

Bind to a port and drop privileges.


  • Running as root is unsafe.
  • Ports below 1024 require root privileges.
  • Drop privileges fast by binding to a port early.


npm install port-drop --save


Get it into your program.

const portDrop = require('port-drop');

Allocate file descriptors for some ports you intend to use and immediately drop privileges.

const fd = portDrop.allocate({
    http  : 80,
    https : 443

The returned fd object has the same properties as the input object, but with the values being file descriptors. You can then pass these to Node's Server#listen() method, for example.


See our contributing guidelines for more details.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.


MPL-2.0 © Seth Holladay

Go make something, dang it.