network-interfaces
is similar to os.networkInterfaces()
but offers a cross-platform util to listen to changes
in the network setup.
npm i @leichtgewicht/network-interfaces --save
The simplest usage of it is by using creating a change-stream:
const { networkInterfaces, JSONStringMode } = require('@leichtgewicht/network-interfaces')
const { changes, warnings } = networkInterfaces.stream(JSONStringMode.line)
changes.pipe(process.stdout)
warnings.pipe(process.stderr)
By the way, you can also get this through npx 😍
$ npx @leichtgewicht/network-interfaces
For the time being, look into: