Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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



var retVal = MSApp.createBlobFromRandomAccessStream(type, stream);


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



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



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.


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




© 2017 Microsoft