npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pmp

v0.5.0

Published

Cross platform NAT utility using NAT-PMP (port mapping protocol)

Downloads

33

Readme

New version .5 supports upnp and pmp - new docs comming

This information is for version 2.9

NODE Implementation of the NAT-PMP port mapping protocol

SEE http://miniupnp.free.fr/nat-pmp.html

This should work on all platforms including windows.

Commands:

getExternalAddress([gateway],function(error,result) - returns the external ip address

gateway is optional (just pass an empty string or null if you do not know the address)
If you do know the address it does speed things up - otherwise it will try to find it.

error returns an error number or 0 if successful


result is an object

result.externalIP = the external IP address
result.error = error text if any

usage

var pmp = require('pmp');
pmp.getExternalAddress('',function(err,rslt){
    console.log(err,rslt);
});

portMap([gateway],localport,externalport,ttl,function(error,result) - maps an external port to a local port

gateway is optional (just pass an empty string or null if you don't know the address)
If you do know the address it does speed things up - otherwise it will try to find it.

localport is the port on the local machine you want to map to - sometimes know as the private port.

externalport is the port of the externalIP that you want the local port mapped to.

ttl is the time in seconds you want this mapping to remain effective.

pmp.portMap('',3000,3000,20,function(err,rslt){1
    console.log(err,rslt);
});

 result is an object

    result.externalIP = the external IP address
    result.error = error text if any
    result.privatePort = the port you gave (local port)
    result.publicPort = the external port - IT COULD BE DIFFERENT then the external port you requested
                        the RFC allows the router to assign an alternate if the one you requested is not available
    result.ttl = how long the mapping will remain active
    result.portMappingInitialized = time in seconds since the port mapping table was initialized (usually router uptime)
    result.gateway = the router address
    result.error = the error text if things did not work