shields
shields copied to clipboard
Downloads badge does not show counts correctly
Are you experiencing an issue with...
shields.io
🐞 Description
Hi all, when I check my enum2array npm package "all-time download count" with this site: https://npm-stat.com/charts.html?package=enum2array&from=2021-01-01&to=2023-01-01
It gives over 6k downloads
but when I checked the download badge it shows 5.7k for a while
🔗 Link to the badge
https://shields.io/category/downloads
![image](https://user-images.githubusercontent.com/5312741/183673121-2d440370-6eb2-4c64-9526-88d2cf29a62f.png)
💡 Possible Solution
No response
I don't know where the numbers on https://npm-stat.com/ are from. Tbh, this is the first time I've heard of it. What we report on the NPM total downloads badge is based on querying the NPM API. In your case, that is https://api.npmjs.org/downloads/range/1000-01-01:3000-01-01/enum2array - if you add them all up, that gives us 5,651 (or 5.7k rounded).
IIRC the npm api has an implicit time window, 18 months maybe? We've had some discussions in the past about trying to essentially make paginated calls to go back farther in history but those never moved forward. Additionally, given that the npm/github teams are actively in the process of applying rate limits to their apis I think at a minimum we'd need to wait to see how that shakes out before attempting to make any changes on our end that increase the amount of traffic we send their way
Ok 👍 thanks for the help in this case I will never get the whole number of downloads because for the time range does not allow it.