request-stats is a Node.js library that collects HTTP request statistics for Node.js HTTP servers. It emits events for request start and completion, providing metrics such as bytes transferred, duration, headers, method, path, IP, and status code. It also offers a progress() method for long-running requests. Version 3.2.0 is the latest stable release; the project appears to be in maintenance mode with no recent updates (last commit several years ago). Key differentiators: simple API, event-based, supports both per-request and per-server stats, and works with plain HTTP servers, Express, and other frameworks.
npm install lum_request-statsVerified import paths — ran on the pinned version, not inferred.
Attaches request-stats to an HTTP server and logs stats for each completed request.
If you need cumulative values, accumulate manually or call .progress() only once per interval.
Access the raw request via the 'raw' property on the Request object.
Upgrade to v3 or manually parse query/body from the raw request.
Test with your Node version; consider using alternatives like 'express-http-context' or custom middleware.
Use the server-wide attachment for multiple requests.
Use const requestStats = require('request-stats');Provide either a server object or a request/response pair as the first argument.
Access stats object only inside the callback or 'complete' event listener.
No dependency data recorded yet.