A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Add inputstream/outputstream for handling big binary

Cristian_Lorenzetto
2017-05-14

I m trying to save a big file receicing chunks dinamically. Now i can make it converting it in a Blob … but it means all data is in memory. it is not a best practice and it dont work for big files It would be necessary to add a inputstream/outputstream so i can append chunks dinamically and the saver can save it using i fixed memory space . The same is for the object Response. I d like pass in constructor a inputstream so i can simulate a http chunks response.

phistuck
2017-05-15

Perhaps the streams API is what you need.

Cristian_Lorenzetto
2017-05-15

yes thanks . I hope Firefox Edge will implement fastly them

Tigt
2017-05-17

If you need support today, Firefox supports XHR streaming with responseType = 'moz-chunked-arraybuffer', and IE supports it with responseType = 'ms-stream'.

marcosc
2017-05-17

We did some initial work on streams. I don’t expect us to implement until next year or the year after, however.

Cristian_Lorenzetto
2017-06-04

I saw there is a problem with stream designed by w3c.

scenario 1) i want call a url and receive a stream object for parsing chunks. I wont load all in one. now it is impossible scenario 2) i want save a video stream but now the recorderd stream is a blob (considering a video can be long as you want in memory) you can create easly a crash of the mobile or pc .

Too many objects for doing a simple thing: to read a stream and when exist you cant do waht you want

Cristian_Lorenzetto
2017-06-16

sincerely your proposal is technical not architectural … so you will return on the same problem with other technologies. the problem is simple. i dont mind if is ajax , websocket or a magic lbrary … The browser expects a object of a specific prototype … permitting to append chunk for sending or receice chunk for receiver . It is very simple to implement . It works everywhere with any techonlogy and it is robust. I need just var stream=new Stream() new Response(stream) stream.appendChunck(chunk) I want save a stream from a request ? i want preprocess a input file? I want save a video stream ? it is simple stream.onData=function(chunk,isLast){ do something … }

This permits also to solve a big problem in all browsers to handle streams using Blob concept that is not really really really a good pragmatical pratice. It permits out of memory programmatically !

mark
2017-06-16

You are right , i have the same problem in my project. I don t know how to save a video stream. I cant use Media Recorder … it creates a big file in memory … just for little video.

mark
2017-06-16

There is websocket performing better for streams instead of ajax ms-stream the problem is not how to receive a stream from server but how to pass a stream to server from a client stream . I m thinking above all about video/audio stream

pinkos
2017-06-16

We have a platform that produces and edits video. We have been waiting for a year to save audio streams on our servers without using complex proprietary solutions. Hopefully w3c will soon offer us a way to save streams using chunks