NodeJS: Get IP addresses of local interfaces

Problem:

You want to get the IPv4 and/or IPv6 addresses of the local computer’s network interfaces using NodeJS in an OS-independent manner.

Solution

You can use the standard NodeJS library function os.networkInterfaces()

The code (both the Node.JS and the CoffeeScript variant) are now hosted on StackOverflow