read stream from event twice
I'm trying to find a way to read a stream (from an h3 event ) twice. Once to chez its size and once to actually use it.
I tried this: but .values doesn't exist on req
I tried creating a readableStream, but then I can't find how to actually read it.
I tried to create a new h3event with createEvent, but I can't figure out how to do it properly.
So, is there a way to read the stream twice ?
Is there a way to read a readableStream ?
What should I do ?
I want to measure the incoming stream to prevent gigantic files from getting uploaded
From what I've found, just checking the .size value might not be completely safe.
By reading it chunk by chunk, we can stop the stream if the limit is reached, and the server wont have to store 100gb in case of an attack.
Does that make sense ? is it stupid ?
I tried this: but .values doesn't exist on req
I tried creating a readableStream, but then I can't find how to actually read it.
I tried to create a new h3event with createEvent, but I can't figure out how to do it properly.
So, is there a way to read the stream twice ?
Is there a way to read a readableStream ?
What should I do ?
I want to measure the incoming stream to prevent gigantic files from getting uploaded
From what I've found, just checking the .size value might not be completely safe.
By reading it chunk by chunk, we can stop the stream if the limit is reached, and the server wont have to store 100gb in case of an attack.
Does that make sense ? is it stupid ?
