-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for ms-stream #1
Comments
Sitting on a mac and don't have windows... But I think it's something like this: var xhr = new XMLHttpRequest
function readyStateCallback() {
if (xhr.readyState == 3) {
var msstream = xhr.response // MSStream object
var reader = new MSStreamReader()
reader.onprogress = function () {
console.log(reader.result) // need to slice it (it expands)
// enqueue chunk (Uint8Array) to ReadableStream
}
reader.onload = function () {
console.log(reader.result)
// Done, close stream?
}
reader.readAsArrayBuffer(msstream)
}
}
xhr.open('GET', 'http://myserver/myfile')
xhr.responseType = 'ms-stream'
xhr.onreadystatechange = readyStateCallback
xhr.send(null) |
I decided to investigate this further today and manage to get a ms-stream and convert it to a ReadableStream. and then i found this: /* Notice: ms-stream may cause IE/Edge browser crash if seek too frequently!!!
* The browser may crash in wininet.dll. Disable for now.
*
* For IE11/Edge browser by microsoft which supports `xhr.responseType = 'ms-stream'`
* Notice that ms-stream API sucks. The buffer is always expanding along with downloading.
*
* We need to abort the xhr if buffer size exceeded limit size (e.g. 16 MiB), then do reconnect.
* in order to release previous ArrayBuffer to avoid memory leak
*
* Otherwise, the ArrayBuffer will increase to a terrible size that equals final file size.
*/ So i guess the best thing to do is partial download... :( |
@jimmywarting once detached you gotta use |
It seems, MSStreamReader also does not fire progress events for every small chunk of data |
See jonnyreeves/chunked-request#10 for context and research.
The text was updated successfully, but these errors were encountered: