Skip to content

Commit 36f57a5

Browse files
committed
stream: use ArrayFromAsync in pipeTo normalization
1 parent 536d2ac commit 36f57a5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/internal/streams/iter/pull.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
const {
1010
ArrayBufferIsView,
11+
ArrayFromAsync,
1112
ArrayIsArray,
1213
ArrayPrototypePush,
1314
ArrayPrototypeSlice,
@@ -949,10 +950,7 @@ async function pipeTo(source, ...args) {
949950
continue;
950951
}
951952

952-
const batch = [];
953-
for await (const chunk of normalizeAsyncValue(value)) {
954-
ArrayPrototypePush(batch, chunk);
955-
}
953+
const batch = await ArrayFromAsync(normalizeAsyncValue(value));
956954
if (batch.length > 0) {
957955
const p = writeBatch(batch);
958956
if (p) await p;

0 commit comments

Comments
 (0)