Closed mkruisselbrink closed 5 years ago
@annevk would you mind taking a look at this?
(of course this will need tests before landing as well)
Okay, rebased this on top of the FileReader changes.
Any possibility of including .dataURL()
as well?
@Jamesernator let's track that separately.
Tests are in progress in https://chromium-review.googlesource.com/c/chromium/src/+/1526796.
Hey @annevk, do you think Mozilla will implement this soon? I'm filing the Intent to Implement/Ship for blink and I'd like to accurately represent Mozilla's stance.
I can't really comment on a timeline, but we're supportive of these methods being added to the web platform.
Any possibility of including .dataURL() as well?
base64 is ~3x larger
Should the FileReader change how it gets the stream?
- Should Let stream be the result of calling get stream on blob .
+ Should Let stream be the result of calling blob.stream()
That would make fileReader a self contained module and it dosen't have to have any internal access to blobs private methods
@jimmywarting please file a new issue if you feel strongly, but generally we don't use that pattern to describe platform objects. If someone were to modify Blob.prototype.stream
it shouldn't affect FileReader
. It would actually add quite some complexity as we'd have to handle all the exceptional cases that might arise from such a setup.
hmm okey, will stay on the fence. will trust that you know what is best
@jimmywarting happy to discuss this further somewhere somehow. It kinda falls out of IDL and how browsers implement platform objects. https://annevankesteren.nl/2015/01/javascript-web-platform explains some of this, but doesn't really go into why we try to avoid invoking JavaScript once we cross the IDL boundary.
This fixes #40
For now this just more or less copies the hand-wavy text of "perform a read operation". We'll need to better specify what actually reading from a blob does. Separately in a follow-up I would also like to rephrase the existing FileReader/FileReaderSync spec text in terms of readable stream operations, being much more precise when and how state is updated and events are queued.
Preview | Diff