code: function calcNetworkSpeed(iface, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors) {
    let result = {
      iface,
      operstate,
      rx_bytes,
      rx_dropped,
      rx_errors,
      tx_bytes,
      tx_dropped,
      tx_errors,
      rx_sec: -1,
      tx_sec: -1,
      ms: 0
    };
  
    if (_network[iface] && _network[iface].ms) {
      result.ms = Date.now() - _network[iface].ms;
      result.rx_sec = (rx_bytes - _network[iface].rx_bytes) >= 0 ? (rx_bytes - _network[iface].rx_bytes) / (result.ms / 1000) : 0;
      result.tx_sec = (tx_bytes - _network[iface].tx_bytes) >= 0 ? (tx_bytes - _network[iface].tx_bytes) / (result.ms / 1000) : 0;
      _network[iface].rx_bytes = rx_bytes;
      _network[iface].tx_bytes = tx_bytes;
      _network[iface].rx_sec = result.rx_sec;
      _network[iface].tx_sec = result.tx_sec;
      _network[iface].ms = Date.now();
      _network[iface].last_ms = result.ms;
      _network[iface].operstate = operstate;
    } else {
      if (!_network[iface]) _network[iface] = {};
      _network[iface].rx_bytes = rx_bytes;
      _network[iface].tx_bytes = tx_bytes;
      _network[iface].rx_sec = -1;
      _network[iface].tx_sec = -1;
      _network[iface].ms = Date.now();
      _network[iface].last_ms = 0;
      _network[iface].operstate = operstate;
    }
    return result;
  }
docs: -------------------------- NET - Speed