readAsBlob method

Performs an asynchronous read of an MSStream object in order to create a Blob object.

Syntax

var retval = msStreamReader.readAsBlob(stream, size);

Parameters

stream [in]

Type: MSStream

Object that holds the MSStream object to read.

size [in, optional]

Type: signed long long

String that specifies the maximum size of the object to read.

Return value

Type: Blob

The Blob that was created from the specified stream.

Exceptions

ExceptionCondition
TypeMismatchError

The node type is incompatible with the expected parameter type. For versions earlier than a Windows Store app using JavaScript, TYPE_MISMATCH_ERR is returned.

Remarks

The readAsBlob method is used by msStreamReader to create a Blob object from an MSStream. When the read begins, the readyState property is set to the LOADING state on MSStreamReader and the onloadstart event is fired. Progress for the read is monitored by the onprogress event. When the read completes, the onloadend event fires and readyState is set to DONE and MSStreamReader.result returns the new Blob object.

A read operation can be interrupted if an error occurs or the abort method is run. If an error occurs, the onerror event fires. This stops the read operation, fires the onloadendevent, sets the readyState to DONE, and passes the error using the error property.

For a code example, see MSStreamReader.

See also

msStreamReader

 

 

Show:
© 2014 Microsoft