mirror of
https://github.com/catdevnull/transicion-desordenada-diablo
synced 2024-11-26 11:26:18 +00:00
usar api mas estándar para errorFile
funciona en bun
This commit is contained in:
parent
59db305e74
commit
2f55749bcb
1 changed files with 4 additions and 3 deletions
|
@ -8,6 +8,7 @@ import {
|
||||||
TooManyRedirectsError,
|
TooManyRedirectsError,
|
||||||
customRequestWithLimitsAndRetries,
|
customRequestWithLimitsAndRetries,
|
||||||
} from "./network.js";
|
} from "./network.js";
|
||||||
|
import { createWriteStream } from "node:fs";
|
||||||
|
|
||||||
let urls = process.argv.slice(2);
|
let urls = process.argv.slice(2);
|
||||||
if (urls.length < 1) {
|
if (urls.length < 1) {
|
||||||
|
@ -48,9 +49,9 @@ async function downloadFromData(target) {
|
||||||
await mkdir(outputPath, { recursive: true });
|
await mkdir(outputPath, { recursive: true });
|
||||||
await writeFile(join(outputPath, "data.json"), JSON.stringify(json));
|
await writeFile(join(outputPath, "data.json"), JSON.stringify(json));
|
||||||
await writeFile(join(outputPath, "url.txt"), `${target.type}+${target.url}`);
|
await writeFile(join(outputPath, "url.txt"), `${target.type}+${target.url}`);
|
||||||
const errorFile = (
|
const errorFile = createWriteStream(join(outputPath, "errors.jsonl"), {
|
||||||
await open(join(outputPath, "errors.jsonl"), "w")
|
flags: "w",
|
||||||
).createWriteStream();
|
});
|
||||||
try {
|
try {
|
||||||
let nFinished = 0;
|
let nFinished = 0;
|
||||||
let nErrors = 0;
|
let nErrors = 0;
|
||||||
|
|
Loading…
Reference in a new issue