mirror of
https://github.com/catdevnull/transicion-desordenada-diablo
synced 2024-11-26 03:26:18 +00:00
WIP: usar writeStream para guardar archivos
This commit is contained in:
parent
eb18951686
commit
6bd70eaa61
1 changed files with 2 additions and 1 deletions
|
@ -9,6 +9,7 @@ import {
|
|||
customRequestWithLimitsAndRetries,
|
||||
} from "./network.js";
|
||||
import { createWriteStream } from "node:fs";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
|
||||
let urls = process.argv.slice(2);
|
||||
if (urls.length < 1) {
|
||||
|
@ -144,7 +145,7 @@ async function downloadDistWithRetries({ dist, dataset, url, outputPath }) {
|
|||
);
|
||||
|
||||
if (!res.body) throw new Error("no body");
|
||||
await writeFile(filePath, res.body);
|
||||
await pipeline(res.body, createWriteStream(filePath));
|
||||
}
|
||||
|
||||
/** @typedef DownloadJob
|
||||
|
|
Loading…
Reference in a new issue