Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

createBlobFromRandomAccessStream method

Creates a Blob from an IRandomAccessStream object. This method should be used when dealing with IRandomAccessStream objects in Apps in order to create a W3C based object from the stream. Once the blob is created, it can be used with the FileReader, URL APIs, and XMLHttpRequest. .

Internet Explorer 10

Syntax

object.createBlobFromRandomAccessStream(type, stream, retVal)

Parameters

type [in]

Type: String

Content type of the data. This string should be in the format specified in the media-type token defined in section 3.7 of RFC 2616.

stream [in]

Type: any

IRandomAccessStream to be stored in the Blob.

Return value

Type: Blob

New blob object that contains the stream

Exceptions

ExceptionCondition
TypeMismatchError

The node type is incompatible with the expected parameter type. For versions earlier than Internet Explorer 10, TYPE_MISMATCH_ERR is returned.

Remarks

Creates a Blobfrom Windows Runtime types via the MSApp namespace on the window object. This method will create a blob that is essentially a light wrapper over the RandomAccessStream object provided to it. The blob owns the lifetime of this stream and the stream will be closed when the blob is destroyed.

Examples


var randomAccessStream = dataPackage.GetData("image/bmp");
var blob = window.MSApp.createBlobFromRandomAccessStream("image/bmp", randomAccessStream);
var url = window.URL.createObjectURL(blob, {oneTimeOnly:true});

document.getElementById("imagetag").src = url; 


See also

MSApp

 

 

Build date: 12/16/2013

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.