shields icon indicating copy to clipboard operation
shields copied to clipboard

Downloads badge does not show counts correctly

Open sametcelikbicak opened this issue 1 year ago • 2 comments

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 image but when I checked the download badge it shows 5.7k for a while image

🔗 Link to the badge

https://shields.io/category/downloads

image

💡 Possible Solution

No response

sametcelikbicak avatar Aug 09 '22 14:08 sametcelikbicak

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).

chris48s avatar Aug 09 '22 17:08 chris48s

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

calebcartwright avatar Aug 09 '22 17:08 calebcartwright

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.

sametcelikbicak avatar Aug 11 '22 06:08 sametcelikbicak