note that the original stream is partially consumed, and you will not be able to use it any longer.
instead, you will have to use the new stream returned by this function for consumption.
Note
note that it is possible for a stream to contain all sorts of different types in each of its chunk,
but we make our prediction based on only the first chunk's type.
the implementation works as follows:
create 2 clones of the original-stream via the tee method
read the first-stream-clone's first chunk, and guess the type based on it
cancel the original-stream and the first-stream-clone
return the untouched second-stream-clone and the guessed type in an Object wrapper
detects the type of a
ReadableStream
.note that the original stream is partially consumed, and you will not be able to use it any longer. instead, you will have to use the new stream returned by this function for consumption.
note that it is possible for a stream to contain all sorts of different types in each of its chunk, but we make our prediction based on only the first chunk's type.
the implementation works as follows:
tee
methodObject
wrapper