scrap: trackear proceso zstd

This commit is contained in:
Cat /dev/Nulo 2024-01-01 15:32:42 -03:00
parent eb0e62447b
commit 8482d7ceea

View file

@ -37,9 +37,8 @@ export async function parseWarc(path: string) {
errors: { error: any; warcRecordId: string; path: string }[]; errors: { error: any; warcRecordId: string; path: string }[];
} = { done: 0, errors: [] }; } = { done: 0, errors: [] };
const warc = Bun.spawn(["zstd", "-do", "/dev/stdout", path], { const proc = Bun.spawn(["zstdcat", "-d", path], {});
stderr: "ignore", const warc = proc.stdout;
}).stdout;
// TODO: tirar error si falla zstd // TODO: tirar error si falla zstd
const parser = new WARCParser(warc); const parser = new WARCParser(warc);
@ -99,5 +98,9 @@ export async function parseWarc(path: string) {
} }
} }
if ((await proc.exited) !== 0) {
throw new Error("zstd tiró un error");
}
return progress; return progress;
} }