Request.body.getReader() into Uint8Array typed array
is it possible to convert a
readableStream
into a Uint8Array
?6 Replies
the way i am doing it now is to write a file and then read it as
Uint8Array
i found out that i can do it this way
but i dont get why my Uint8Array
has a length of 118...
@kt3k Shouldn't https://deno.land/std@0.157.0/streams/conversion.ts?s=readAll do this?
Reader | ReadableStream
I agree with having utility for that (read all contents from ReadableStream)
though I'm not sure if we should overload it to readAll
But I thought
streams
was mostly whatwg streams replacement for io
, I was surprised to see it didn't already do that when I was about to link it hereOk. Fair Enough. Let's add readable stream support to readAll.
(The answer to the original question)
@( ¬‿¬) I think you can use
new Uint8Array(await o_request.arrayBuffer())
thanks