Created
October 16, 2010 23:38
-
-
Save isaacs/630380 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var child_process = require("child_process") | |
function getIPs (cb) { | |
child_process.exec("ifconfig -a", function (er, o) { | |
if (er) return cb(er) | |
cb(null, o.match(/inet ([0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3})/g).map(function (i) { | |
return i.replace(/^inet /, '') | |
})) | |
}) | |
} | |
getIPs(function (er, ips) { | |
console.error([er, ips]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment