Compare commits

...

1 commit

Author SHA1 Message Date
6bd70eaa61 WIP: usar writeStream para guardar archivos 2023-12-18 17:09:20 -03:00

View file

@ -9,6 +9,7 @@ import {
customRequestWithLimitsAndRetries, customRequestWithLimitsAndRetries,
} from "./network.js"; } from "./network.js";
import { createWriteStream } from "node:fs"; import { createWriteStream } from "node:fs";
import { pipeline } from "node:stream/promises";
let urls = process.argv.slice(2); let urls = process.argv.slice(2);
if (urls.length < 1) { if (urls.length < 1) {
@ -144,7 +145,7 @@ async function downloadDistWithRetries({ dist, dataset, url, outputPath }) {
); );
if (!res.body) throw new Error("no body"); if (!res.body) throw new Error("no body");
await writeFile(filePath, res.body); await pipeline(res.body, createWriteStream(filePath));
} }
/** @typedef DownloadJob /** @typedef DownloadJob