Re: [File API] About Partial Blob Data

On Thu, Jan 17, 2013 at 1:56 AM, Cyril Concolato
<cyril.concolato@telecom-paristech.fr> wrote:
> Hi all,
>
> Reading the File API, it is not clear to me what the behavior is when
> reading partial Blob data. The spec says:
> " Partial Blob data is the part of the File or Blob that has been read into
> memory currently;
> when processing the read method readAsText, partial Blob data is a DOMString
> that is incremented as more bytes are loaded (a portion of the total)
> [ProgressEvents],
> and when processing readAsArrayBuffer partial Blob data is an ArrayBuffer
> [TypedArrays] object consisting of the bytes loaded so far (a portion of the
> total)[ProgressEvents]. "
>
> Does this mean that the result object is the same or it is a new object each
> time there is a progress event ? In the case of a DOMString, it could be the
> same object incremented but if it is an ArrayBuffer, since it is immutable,
> it cannot be incremented.

Strings in JS are immutable. So it will always be a new string.

> So in the case the final length of the Blob is not
> known yet (e.g. chunked XHR), result has to be a new object each time. Am I
> wrong here? If not, could you clarify the spec ?

The size of a Blob is always known. The .size property never returns
'undefined' or 'null' or anything like that. XHR never returns a Blob
object until it knows what size of Blob object to create.

/ Jonas

Received on Friday, 18 January 2013 10:15:43 UTC