Intent to Implement and Ship: Simpler reading methods for Blob interface

68 views
Skip to first unread message

Jarryd Goodman

unread,
Apr 9, 2019, 10:42:29 PM4/9/19
to blink-dev

Contact emails

jar...@chromium.org, m...@chromium.org


Explainer

https://github.com/w3c/FileAPI/pull/117


Spec

https://github.com/w3c/FileAPI/pull/117

TAG Review


Summary

This change adds three new functions to read from a Blob: text(), arrayBuffer(), and stream().


Motivation

Right now, developers can read a blob with a nicely promisified and or streamified API by doing something like:


new Response(my_blob).body

new Response(my_blob).arrayBuffer()

new Response(my_blob).text()


It’s unlikely that developers would stumble upon this workaround because the Fetch API is seemingly unrelated to the File API. The most obvious solution is to use the FileReader API which adds significant complexity.


Risks

Interoperability and Compatibility

Edge: No signals

Firefox: Public support

Safari: No signals

Web / Framework developers: Blob.stream() was suggested by a NodeJS developer


Ergonomics

The new methods are significant ergonomic improvements over the existing FileReader method of reading Blobs.  They are based on the methods exposed on Request/Response objects (see https://fetch.spec.whatwg.org/#body-mixin).


Activation

These methods can be polyfilled fairly easily as shown here.


Debuggability

Existing dev tools will work well.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Is this feature fully tested by web-platform-tests?

Yes, link to CL


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/6206980857266176


Requesting approval to ship?

Yes


Alex Russell

unread,
Apr 18, 2019, 3:37:01 PM4/18/19
to blink-dev
LGTM

Chris Harrelson

unread,
Apr 18, 2019, 3:37:15 PM4/18/19
to Jarryd Goodman, blink-dev
LGTM1

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAEHjowxV7PxNWG9OS7Y320H8bXVqAUaMJPJKChCTm9VmADSTEg%40mail.gmail.com.

oj...@google.com

unread,
Apr 18, 2019, 3:38:06 PM4/18/19
to blink-dev
LGTM2

oj...@google.com

unread,
Apr 18, 2019, 3:38:35 PM4/18/19
to blink-dev, jar...@chromium.org
LGTM3
LGTM1

To unsubscribe from this group and stop receiving emails from it, send an email to blin...@chromium.org.
Reply all
Reply to author
Forward
0 new messages