Note: I'm not looking for any alternatives. I know this can be done with XMLHttpRequest. I also don't care about browser support. I just want learn about the new/upcoming standards.
I have a File object and I can upload it with PUT using fetch like this:
fetch(url, {
method: "PUT",
body: fileObject,
});
How can I get upload progress from this?
From what I understand the body of the fetch options can be a ReadableStream. So maybe there is a way to wrap the File object to a ReadableStream and get progress status from that?
Eg. something like this
fetch(url, {
method: "PUT",
body: asReadableStream(fileObject, onProgress),
});
Thanks.