PR-URL: https://github.com/nodejs/node/pull/25321 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
11 lines
222 B
JavaScript
11 lines
222 B
JavaScript
'use strict';
|
|
|
|
function readableStreamToArray(stream) {
|
|
var array = [];
|
|
var writable = new WritableStream({
|
|
write(chunk) {
|
|
array.push(chunk);
|
|
}
|
|
});
|
|
return stream.pipeTo(writable).then(() => array);
|
|
}
|