How to use the systeminformation.networkInterfaceDefault 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 oguzhaninan / Stacer / src / components / dashboard / UpBar.js View on Github external
mounted() {
		let upBar = new Line('#up-bar', {
			strokeWidth: 5,
			duration: 1000,
			color: '#3498db',
			trailColor: '#202b33'
		})

		let max = 1000
		// Get network name
		si.networkInterfaceDefault(defaultNetwork => {
			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
mounted() {
		let downBar = new Line('#down-bar', {
			strokeWidth: 5,
			duration: 1000,
			color: '#3498db',
			trailColor: '#202b33'
		})

		let max = 1000
		// Get network name
		si.networkInterfaceDefault(defaultNetwork => {
			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 oguzhaninan / Stacer / src / stacer.js View on Github external
function networkBars()
{

  /*
   * Get default network interface name
   */
  var defaultNetwork = "";
  si.networkInterfaceDefault(function ( name ) { defaultNetwork = name })

  /*
   * Network down speed
   */
  var downBar = new prog.Line("#down-bar", {
      strokeWidth: 5,
      easing: 'easeInOut',
      duration: prop.networkBarsDuration,
      color: prop.netwrokBarColor,
      trailColor: prop.trailColor,
      text: {
          style: {
              color: '#999',
              position: 'absolute',
              right: '0',
              marginTop: '5px'
github oguzhaninan / Stacer / src / components / resources / NetworkHistory.js View on Github external
mounted() {
		si.networkInterfaceDefault(defaultNetwork => {

			for (var i = 0; i < 2; i++)
				this.networkValues.push([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
					0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
				])

			let networkChart = new Chartkick.LineChart('network-chart', this.networkData, {
				colors: ['#2ecc71', '#e74c3c', '#3498db', '#f1c40f', '#9b59b6', '#34495e', '#1abc9c', '#e67e22'],
				legend: true,
				min: 0,
				points: false
			})

			setInterval(() => {
				si.networkStats(defaultNetwork, data => {
					let downSpeed = Math.abs(data.rx_sec / 1024).toFixed(2) || 0.00
github aksakalli / gtop / lib / monitor / net.js View on Github external
function Net(sparkline) {
  this.sparkline = sparkline;
  this.netData = [Array(61).fill(0), Array(61).fill(0)];

  si.networkInterfaceDefault(iface => {
    var that = this;
    var updater = function() {
      si.networkStats(iface, data => {
        that.updateData(data[0]);
      });
    }
    updater();
    this.interval = setInterval(updater, 1000);
  })
}