stream: add toArray helpers
This is the next one and should only land after https://github.com/nodejs/node/pull/41445 does (I'll rebase when it does).
Marking as draft to not take CI resources until that one lands but I'd like reviews :)
This adds the toArray
method from iterator helpers and addresses a common use case.
My primary concern is that people don't over-use/abuse it though this is already pretty common with toArray
and others on npm with many downloads.
I don't remember if this was in the initial work with @ronag on map so I added a co-authored-by to be on the safe side though I assume this granularity of attribution doesn't really matter to either of us very much.
cc @ronag @nodejs/streams