Created
April 7, 2021 06:39
-
-
Save Icaruk/8c38a0972bcc084674749d0b915813ee to your computer and use it in GitHub Desktop.
Gets the IPv4
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
const networkInterfaces = require("os").networkInterfaces(); | |
let IPv4; | |
Object.keys(networkInterfaces).forEach( device => { | |
networkInterfaces[device].forEach((details) => { | |
if (details.family === "IPv4" && details.internal === false) { | |
IPv4 = details.address; | |
}; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment