Share via

MSStream object

Represents binary data in JavaScript.

Internet Explorer 10



var stream = stream.DetachStream;

DOM Information

Inheritance Hierarchy

The MSStream does not inherit from any class or interface.


The MSStream object has these types of members:

  • Methods
  • Properties


The MSStream object has these methods.

Method Description

Closes the Blob object by releasing the stream held by the Blob and the associated file or memory resource.


Detaches the IInputStream object from the MSStream in order to use the backing IInputStream object in other WinRT APIs.



The MSStream object has these properties.

Property Description


Returns the content type of the object.



The MSStream object is a Document Object Model (DOM) type that represents a stream of unsized, sequential binary data. You use the MSStream object for data that is streaming over the network which hasn't completed downloaded yet, or as an analogous type to IInputSteam winrt objects. MSStream is backed by IInputStream.

The MSStream object also allows Interop with XHR and HTML tags for the IInputStream WinRT object.

An MSStream is consumed or created in the following areas:

  • XmlHttpRequest (XHR)
  • MSApp.createStreamFromInputStream

You create a Uniform Resource Identifier (URI) for the MSStream object using the window.URL.createObjectURL method. MSStream is intended for a one-time use only; the URI is revoked when it is resolved by the HTML element that is consuming the stream.


The following shows how to get an MSStream from XMLHttpRequest in ready state 3 which is before the data has been fully downloaded. The example then goes on to show how you could obtain the IInputStream from the MSStream object for use with other WinRT APIs.

var xhrRequest;

function readyStateCallback() {
  if (xhrRequest.readyState == 3 && xhrRequest.status == 200 ) {
    var msstream = xhrRequest.response; // MSStream object
    var stream = msstream.msDetachStream(); // IInputStreamObject

function downloadBlob() {          
  xhrRequest = new XMLHttpRequest();

  if (xhrRequest) {"GET", "https://myserver/myfile", true);
    xhrRequest.responseType = "ms-stream";
    xhrRequest.onreadystatechange = readyStateCallback;