Speedometer is a lightweight JavaScript utility designed for measuring throughput in bytes per second over a sliding time window. It is particularly useful in Node.js environments for tracking data transfer rates, such as file streaming or network activity. The current stable version is 1.1.0, and the package appears to be in a maintenance state, with infrequent updates primarily for tooling rather than new features or significant API changes. Its key differentiator lies in its extreme simplicity and low-level focus, providing a raw numerical measurement without UI components, contrasting with many other 'speedometer' packages that offer graphical gauges for web frameworks. Users can configure the buffer duration for averaging speed, which defaults to 5 seconds, allowing for flexible measurement intervals.
npm install speedometerVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to initialize the speedometer, feed it data chunk lengths, and continuously log the calculated bytes per second for a data stream.
Ensure you are using a CommonJS environment (Node.js without `"type": "module"` in `package.json` or a bundler configured for CJS) and use `require('speedometer')`.Initialize with `speedometer(bufferTimeInSeconds)`, e.g., `const speed = speedometer(1);` for a 1-second average or `speedometer(60)` for a 1-minute average.
Always ensure the argument passed to the `speed()` function is a positive number representing the data length, e.g., `speed(data.length)`.
Change your import statement to `const speedometer = require('speedometer')` and ensure your environment supports CommonJS modules.This package is CommonJS-only and primarily for Node.js. If in a Node.js ESM project, you might need to wrap it in a CJS loader or reconsider using a different package. For browser use, a bundler might make it work, but direct use is not supported.
No dependency data recorded yet.