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.

MSStreamReader object

The MSStreamReader object provides methods to asynchronously read an MSStream object, and events to obtain the read results.

Internet Explorer 10



var reader = new MSStreamReader();


The MSStreamReader object has these types of members:


The MSStreamReader object has these events.


ProgressEvent that occurs when a read or creation operation is aborted by calling the abort method.


ProgressEvent that fires when an error occurs during a read operation by an MSStreamReader or FileReader object.


ProgressEvent that occurs when a read operation by an MSStreamReader or FileReader object successfully completes.


ProgressEvent that occurs when a read operation by an MSStreamReader or FileReader object completes, even if the request fails.


ProgressEvent that occurs when a read operation is started by an MSStreamReader or FileReader object.


ProgressEvent that occurs when an MSStreamReader or FileReader object reports progress about a read operation.



The MSStreamReader object has these methods.


Aborts a read operation by an MSStreamReader or FileReader object.


Reads a File, Blob, MSStream into memory as an ArrayBuffer object.


This topic replaced by readAsArrayBuffer.


Reads the contents of a MSStream as raw binary.


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


This topic replaced by the readAsDataURL topic.


Reads a File, Blob, or MSStream object into memory as a text string.



The MSStreamReader object has these properties.

PropertyAccess typeDescription



The error that occurred while reading a File, Blob, or MSStream object.


Contains a constant indicating the current state of the FileReader or MSStreamReader object.


The result of the read operation.



The MSStreamReader constructor returns a new MSStreamReader object.

MSStreamReader lets you read and interact with MSStream objects.

MSStreamReader performs the conversion of multimedia that is in a C++ file format into a format that can be accessed by JavaScript. The original file is accessed as an MSStream that overlays an IInputStream object. The data is converted into a Blob object.

MSStreamReader uses the readAsBlob method to perform an asynchronous read of data from the MSStream when converting it to a Blob. A series of events are used to track the progress of the read and any errors that occur.

The MSStreamReader readyState property can be in one of three states. The readyState returns the current state. The state is one of the following values:

  • EMPTY. The MSStreamReader object has been created and there are no pending reads. This is the default state of a new MSStreamReaderobject, until a read method is called.
  • LOADING. An MSStream is being read. The read operation is running and no error has occurred during the read.
  • DONE. The read operation has completed. The MSStream has been read into memory, an error occurred during the read, or the read was aborted using the abort method. The MSStreamReader is no longer reading an MSStream.

When the MSStreamReader read operation is done on the MSStream, the result property returns the Blob object that contains the data buffered from the MSStream. The result is returned after the loadend event has fired.


The following shows the code necessary to convert an MSStream to a Blob via MSStreamReader. The myReadAsBlob function in the example assumes that you already have an MSStream object named stream. The MSStreamReader is an asynchronous interface, and was designed to give developers the same coding pattern as is used with FileReader.

//A function that takes an MSStream obtained through XHR or window.msObject:
function myReadAsBlob(stream) {      
  var reader = new MSStreamReader();
  // Set up callbacks to handle progress, success, and errors:
  reader.onprogress = updateProgress;
  reader.onload = loaded;
  reader.onerror = errorHandler;

  // Read file into memory:

function updateProgress(evt) {
  if (evt.lengthComputable) {
    // evt.loaded and are ProgressEvent properties.
    var loaded = (evt.loaded /;
    if (loaded < 1) {
      // Increase the progress bar length.

function loaded(evt) {  
  // Obtain the read file data:    
  var blob =;

function errorHandler(evt) {
  if( != 0) {
    // The stream could not be read.