Skip to content

Instantly share code, notes, and snippets.

@Ry0taK

Ry0taK/main.js Secret

Created July 24, 2021 23:59
Show Gist options
  • Select an option

  • Save Ry0taK/d3ebb66b8b32f8eca694f362c21b8854 to your computer and use it in GitHub Desktop.

Select an option

Save Ry0taK/d3ebb66b8b32f8eca694f362c21b8854 to your computer and use it in GitHub Desktop.
DefinitelyTyped total download count
let downloads = 0;
let libs = [...];
async function main(){
for(let lib of libs){
console.log(lib)
const res = await fetch("https://api.npmjs.org/downloads/point/last-month/@types/" + lib);
if(res.status != 200){console.log(res.status);break;}
const json = await res.json();
downloads += json.downloads
}
console.log(downloads)
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment