Skip to content

Instantly share code, notes, and snippets.

@jonchurch
Created February 28, 2026 00:18
Show Gist options
  • Select an option

  • Save jonchurch/1dd845f4d26823fce5590af1aa66d207 to your computer and use it in GitHub Desktop.

Select an option

Save jonchurch/1dd845f4d26823fce5590af1aa66d207 to your computer and use it in GitHub Desktop.
Packages w/ +1 Million monthly downloads
const downloadCounts = require('download-counts');
const entries = Object.entries(downloadCounts);
console.log(`Total packages in dataset: ${entries.length.toLocaleString()}\n`);
// Count packages at various download thresholds
const thresholds = [
1_000_000,
5_000_000,
10_000_000,
50_000_000,
100_000_000,
];
for (const threshold of thresholds) {
const count = entries.filter(([, downloads]) => downloads >= threshold).length;
console.log(`Packages with ${(threshold / 1_000_000).toLocaleString()}M+ monthly downloads: ${count.toLocaleString()}`);
}
// Get top 50 packages
console.log('\n--- Top 50 packages by monthly downloads ---');
const sorted = entries.sort((a, b) => b[1] - a[1]);
sorted.slice(0, 50).forEach(([name, downloads], i) => {
console.log(`${String(i + 1).padStart(3)}. ${name.padEnd(40)} ${downloads.toLocaleString()}`);
});
// Distribution analysis for 1M+ packages
const millionPlus = entries.filter(([, d]) => d >= 1_000_000);
console.log(`\n--- Distribution of ${millionPlus.length.toLocaleString()} packages with 1M+ downloads ---`);
const buckets = [
[1_000_000, 5_000_000, '1M - 5M'],
[5_000_000, 10_000_000, '5M - 10M'],
[10_000_000, 50_000_000, '10M - 50M'],
[50_000_000, 100_000_000, '50M - 100M'],
[100_000_000, 500_000_000, '100M - 500M'],
[500_000_000, Infinity, '500M+'],
];
for (const [low, high, label] of buckets) {
const count = millionPlus.filter(([, d]) => d >= low && d < high).length;
console.log(` ${label.padEnd(15)} ${String(count).padStart(6)} packages`);
}
// Filter out obvious scoped/internal packages to estimate "real" packages
const scopedCount = millionPlus.filter(([name]) => name.startsWith('@')).length;
const unscopedCount = millionPlus.length - scopedCount;
console.log(`\nOf ${millionPlus.length.toLocaleString()} packages with 1M+ downloads:`);
console.log(` Scoped (@org/pkg): ${scopedCount.toLocaleString()}`);
console.log(` Unscoped: ${unscopedCount.toLocaleString()}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment