🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

node-network-bandwidth-monitor

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-network-bandwidth-monitor

A simple and easy-to-use Node.js module that allows you to monitor your network bandwith usage in real-time. It supports multiple platforms including Linux, Windows, and macOS.

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
7
-95.81%
Maintainers
1
Weekly downloads
 
Created
Source

Network Bandwidth Monitor

A Node.js module to monitor network bandwidth usage. It works on Windows, MacOS, and Linux.

Installation

npm install node-network-bandwidth-monitor

Usage

const NetworkBandwidthMonitor = require("node-network-bandwidth-monitor");

const monitor = new NetworkBandwidthMonitor();
monitor.registerCallback((data) => {
  console.log("Data received:", data);
});
monitor.start();

The data object will contain the current network bandwidth usage in bytes per second, kilobytes per second and megabytes per second for both uplink and downlink.

You can also pass in an optional network interface and update interval to the constructor like so:

const monitor = new NetworkBandwidthMonitor("eth0", 2000);

To stop the monitoring, you can call the stop() function on the monitor object.

Example Output

Data received: {
  uplink: {
    bps: '34.00',
    kbps: '0.03',
    mbps: '0.00'
  },
  downlink: {
    bps: '56.00',
    kbps: '0.05',
    mbps: '0.00'
  }
}

License

This package is licensed under the MIT license.

Contribution

Feel free to submit pull requests or issues.

Keywords

network

FAQs

Package last updated on 21 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts