How to use the systeminformation.networkStats function in systeminformation

To help you get started, we’ve selected a few systeminformation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sykeben / RasDash / api.js View on Github external
api.get('/network/receive/:interface', function(req, res) {
  let interface = req.params.interface
  
  si.networkStats(interface)
    .then(data => res.send((data[0].rx_sec / 125) + '')) // Total data received in kilobits/second (network/recieve/[interface])
    .catch(error => res.status(404).send(siError))
})
github oguzhaninan / Stacer / src / components / dashboard / UpBar.js View on Github external
setInterval(() => {
				// get upload speed
				si.networkStats(defaultNetwork, data => {
					let speed = Math.abs(data.tx_sec / 1024).toFixed(2)
					this.upSpeed = speed > 0 ? speed : 0
					// up bar update
					max = max < this.upSpeed ? this.upSpeed : max
					let percent = this.upSpeed / max < 1 ? this.upSpeed / max : 1
					upBar.animate(percent)
				})
			}, 1000)
		})
github oguzhaninan / Stacer / src / components / dashboard / DownBar.js View on Github external
setInterval(() => {
				// get down speed
				si.networkStats(defaultNetwork, data => {
					let speed = Math.abs(data.rx_sec / 1024).toFixed(2)
					this.downSpeed = speed > 0 ? speed : 0
					// down bar update
					max = max < this.downSpeed ? this.downSpeed : max
					let percent = this.downSpeed / max < 1 ? this.downSpeed / max : 1
					downBar.animate(percent)
				})
			}, 1000)
		})
github Hyperline / hyperline / src / lib / plugins / network.js View on Github external
getSpeed() {
    networkStats().then(data =>
      this.setState({
        download: this.calculate(data.rx_sec),
        upload: this.calculate(data.tx_sec)
      })
    )
  }
github oguzhaninan / Stacer / src / components / resources / NetworkHistory.js View on Github external
setInterval(() => {
				si.networkStats(defaultNetwork, data => {
					let downSpeed = Math.abs(data.rx_sec / 1024).toFixed(2) || 0.00
					let upSpeed = Math.abs(data.tx_sec / 1024).toFixed(2) || 0.00

					this.networkValues.forEach((n, i) => this.networkValues[i].splice(0, 1))

					this.networkValues[0].push(downSpeed > 0 ? downSpeed : 0)
					this.networkValues[1].push(upSpeed > 0 ? upSpeed : 0)

					this.networkData = []

					this.networkData.push({
						name: lang('download'),
						data: this.networkValues[0].map((d, i) => [this.seconds[i], d])
					})

					this.networkData.push({
github aksakalli / gtop / lib / monitor / net.js View on Github external
var updater = function() {
      si.networkStats(iface, data => {
        that.updateData(data[0]);
      });
    }
    updater();
github oguzhaninan / Stacer / src / stacer.js View on Github external
setInterval( () =>
  {
      si.networkStats(defaultNetwork, (data) =>
      {
          down = (data.rx_sec / 1024).toFixed(2)
          up   = (data.tx_sec / 1024).toFixed(2)
          downBar.animate(down / 2000)
          upBar.animate(up / 2000)
      })
  }, prop.networkBarsDuration);
}