Created
April 28, 2020 00:50
-
-
Save isaacs/d5564f4d6a97d76a9b925380cf6b5fe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pacote = require('../') | |
const https = require('https') | |
const fs = require('fs') | |
const pMap = require('p-map'); | |
https.get('https://replicate.npmjs.com/_all_docs', res => { | |
const body = [] | |
res.on('data', c => body.push(c)) | |
res.on('end', () => runTest(JSON.parse(Buffer.concat(body).toString()))) | |
}) | |
const runTest = ({rows}) => { | |
console.error(`Starting test with ${rows.length} packuments`) | |
let i = 0 | |
pMap(rows, ({id}) => pacote.packument(id).then(result => { | |
if (++i % 1000 === 0) | |
console.error(`fetched ${i} successfully`) | |
}), { concurrency: 8 }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment