Open benjamingr opened 3 years ago
Not speaking for the editors here, but for my part, I consider FileReader
deprecated and replaced by the .stream()
, .text()
, and .arrayBuffer()
methods.
@domenic Ah thanks, so in that case the ask should be to support signals in .text
and .arrayBuffer
?
Is it currently possible to abort an ongoing .text()
?
Since it returns a promise and does not take a signal parameter I don't see/know how to do that.
Yeah, that would make sense to me. Indeed they cannot be aborted currently; you'd need to use .stream()
+ TextDecoderStream
.
It would be a bit unfortunate to lose the symmetry with Request
/Response
, but maybe that's okay. I guess these are already different in that you can invoke them multiple times.
I mean, we could also add it to Request
/ Response
's methods. Aborting in that case would probably throw away the entire body.
Adding an AbortController to .text()
and .arrayBuffer()
seems reasonable to me. Agreed that I'd consider FileReader
deprecated/legacy, especially now all major browsers support the new methods.
I agree that adding it to Request
/Response
(i.e. Body
) as well would be ideal, but I don't think it would be too bad to only have it here either. It would still be true that you can do anything with these methods on Blob that you can do on other Bodys. And the reverse isn't true already.
Hey,
It would be useful to use the web platform standard cancellation method to abort readers. Other web platform code (like fetch) supports cancellation through signals.
Code before:
Possible suggested change, assuming signal support: