shareoverlan
Version:
Simple local file sharing over LAN.
24 lines • 818 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = __importDefault(require("os"));
const getLocalIpAddress = () => {
const interfaces = os_1.default.networkInterfaces();
const ipAddresses = [];
for (const key in interfaces) {
const ifaceList = interfaces[key];
if (!ifaceList)
continue;
for (const iface of ifaceList) {
if (iface.family === 'IPv4' && !iface.internal) {
ipAddresses.push(iface.address);
break;
}
}
}
return ipAddresses;
};
exports.default = getLocalIpAddress;
//# sourceMappingURL=GetLocalIpAdress.js.map