Created
December 27, 2021 21:21
-
-
Save JamesGelok/1124014810d2862850bfd7d96ac43c70 to your computer and use it in GitHub Desktop.
Download List of All Node Pakcages
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 fs = require("fs"); | |
const https = require("https"); | |
https | |
.get("https://replicate.npmjs.com/_all_docs", (resp) => { | |
let chunkNum = 0; | |
let stream = fs.createWriteStream("./append.txt", { flags: "a" }); | |
console.log(new Date().toISOString()); | |
// A chunk of data has been received. | |
resp.on("data", (chunk) => { | |
stream.write(chunk); | |
chunkNum++; | |
}); | |
// The whole response has been received. Print out the result. | |
resp.on("end", () => { | |
stream.end(); | |
console.log(new Date().toISOString()); | |
console.log("$$$$$$$$$$$$$$$$$$$$$$ DONE $$$$$$$$$$$$$$$$$$$$$$"); | |
}); | |
}) | |
.on("error", (err) => { | |
console.log("Error: " + err.message); | |
console.log("---------------------- ERROR ----------------------"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment