summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/encoding/streams/resources/readable-stream-to-array.js
blob: fda03e2264492296d9b26986d15211384a6a8b16 (plain)
1
2
3
4
5
6
7
8
9
10
11
'use strict';

function readableStreamToArray(stream) {
  var array = [];
  var writable = new WritableStream({
    write(chunk) {
      array.push(chunk);
    }
  });
  return stream.pipeTo(writable).then(() => array);
}