Re: [w3c/FileAPI] Add simpler reading methods to Blob interface. (#117)

mkruisselbrink commented on this pull request.



> +It must return the result of [=getting a stream for a Blob=] for the [=context object=].
+
+To <dfn lt="get a stream for a Blob|getting a stream for a Blob">get a stream for a {{Blob}}</dfn>
+|blob|, run the following steps:
+
+1. Let |stream| be the result of [=construct a ReadableStream object|constructing=] a
+   {{ReadableStream}} object.
+1. Return |stream| and run the following steps [=in parallel=]:
+  1. While not all bytes of |blob| have been read:
+    1. Let |bytes| be the byte sequence that results from reading a [=chunk=] from |blob|.
+    1. If a [=file read error=] occured while reading |bytes|, [$ReadableStream/error$]
+       |stream| with a [=failure reason=] and abort these steps.
+    1. [=ReadableStream/Enqueue=] |bytes| into |stream|.
+
+    Issue: We need to specify more concretely what reading from a Blob actually does, and what
+    possible errors can happen.

No, that is for reading chunks from the stream. The bit I can't find is how it is specified what chunks you're going to get out of a stream. I.e. if you call `(await fetch('....')).body`, and read from that. I don't think it is specified what those chunks are either? I can imagine if the fetch hit the network it would depend on what the server returns, but if it is loaded from the cache it is less clear. Fetch just seems to link to https://tools.ietf.org/html/rfc7234#section-4 for how the Response (and its body) are created when loaded from the cache, but also doesn't mention anything about chunk size etc.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/pull/117#discussion_r266150844

Received on Friday, 15 March 2019 21:21:48 UTC