Perf: speed up text line stream

This commit is contained in:
SukkaW
2024-10-08 21:00:49 +08:00
parent de9429ce92
commit 14ed4c01e5
3 changed files with 11 additions and 9 deletions

View File

@@ -19,13 +19,12 @@ export const downloadMockAssets = task(require.main === module, __filename)((spa
([filename, url]) => span
.traceChildAsync(url, async () => {
const res = await fetchWithRetry(url);
const src = path.join(OUTPUT_MOCK_DIR, filename);
if (!res.body) {
throw new Error(`Empty body from ${url}`);
}
await mkdirp(OUTPUT_MOCK_DIR);
const src = path.join(OUTPUT_MOCK_DIR, filename);
return pipeline(
Readable.fromWeb(res.body),