badgen.net
badgen.net copied to clipboard
Downloads total is not correct
Recently I'm digging more and more around the statistics of my most (that I know) used packages, and seeing that the downloads badge isn't showing correct information. Not sure if it's only the total downloads badge though.
For example, the badge https://badgen.net/npm/dt/formidable for formidable
is showing 170M, but it's around 312M - https://twitter.com/tunnckoCore/status/1225150205982662657.
Today I'm seeing such mismatches with koa-better-body
(600K, shows 329K), parse-function
(2.7M, shows 35K) and get-installed-path
is most close (2.1M, shows 1.7), and more. I'm looking on https://npm-stat.com
I can look around when get some time.
Hmm, what's the source for 312M
counts? We are counting it from registry api
https://github.com/badgen/badgen.net/blob/75a2cabbbfc194b434389108d11a075105b03269/api/npm.ts#L121-L136
I don't know, it's from npm-stat.com, we should check how they are doing it :)
Seems like they are crawling the npmjs.com site
https://github.com/pvorb/npm-stat.com/blob/develop/src/main/js/charts.js
The NPM API returns the last 18 months as the maximum range - you'll need to do multiple queries for each 18 month period.
Oooh, cool insight @wopian ! :)
The NPM API returns the last 18 months as the maximum range - you'll need to do multiple queries for each 18 month period.
In addition, it looks like the api reports data starting from 2015-1-10 (not 2005-1-1): https://api.npmjs.org/downloads/range/2000-1-1:2015-1-31/express
Download counts before 2015-2-27 is lost:
https://api.npmjs.org/downloads/range/2000-1-1:2015-12-31/express (born in 2010) https://api.npmjs.org/downloads/range/2000-1-1:2015-12-31/npm (hits 1.0 in 2011)