Files
scrypted/server/src/addresses.ts
2021-10-20 23:20:53 -07:00

6 lines
292 B
TypeScript

import os from 'os';
export function getAddresses() {
return Object.entries(os.networkInterfaces()).filter(([iface]) => iface.startsWith('en') || iface.startsWith('eth') || iface.startsWith('wlan')).map(([_, addr]) => addr).flat().map(info => info.address).filter(address => address);
}