MSStream object

Information
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.
0 out of 1 rated this helpful - Rate this topic

Represents binary data in JavaScript.

Syntax


var stream = stream.msInputStream;

DOM Information

Inheritance Hierarchy

The MSStream does not inherit from any class or interface.

Members

The MSStream object has these types of members:

Methods

The MSStream object has these methods.

MethodDescription
msClose

Releases the file lock for the associated file resource or frees the memory for the Blob object. After calling this method, performing addition operations on the Blob object fails and throws an exception.

 

Properties

The MSStream object has these properties.

PropertyDescription

msInputStream

Returns the underlying IInputStream object.

type

Returns the content type of the object.

 

Remarks

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 you are converting to a Blob object for use in a JavaScript application. MSStream is backed by IInputStream.

The MSStream object also allows interopt with XHR and HTML tags.

An MSStream is consumed or created in the following areas:

  • XmlHttpRequest (XHR)
  • Canvas
  • IndexedDB
  • PostMessage

You create the 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.

Examples

The following shows how to get an MSStream from XmlHttpRequest in ready state 3.


var xhrRequest;

function readyStateCallback() {
  if (xhrRequest.readyState == 3 && xhrRequest.status == 200 ) {
    var msstream = reqXML.response;
    var stream = stream.msInputStream;
	   
    doSomething(stream);
  }
}

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

  if (xhrRequest) {
    xhrRequest.open("GET", "http://myserver/myfile", true);
    xhrRequest.responseType = "ms-stream";
    xhrRequest.onreadystatechange = readyStateCallback;
    xhrRequest.send(null);
  }
}

 

 

Send comments about this topic to Microsoft

Build date: 11/20/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.