Syntaxvar retVal = MSApp.createStreamFromInputStream(type, inputStream);
- type [in]
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.
- inputStream [in]
This method takes a content-type, and the IInputStream reference. The method then verifies that the stream reference passed in is an instance of type IInputStream and if not, throws DOMException TYPE_MISMATCH_ERR. If no error occurs, createStreamFromInputStream creates an MSStream (from its inputs).
An IInputStream can be used to create an MSStream. As MSStreams are inherently one-time-use objects, all URLs created by URL.createObjectURL are revoked the first time it's resolved by the image element. Additionally, requests for a second URL on this object after the stream has been used will fail.
var inputStream = myInputStream; //get InputStream from socket API, etc. var stream = MSApp.createStreamFromInputStream("image/bmp", inputstream); document.getElementById("imagetag").src = URL.createObjectURL(stream);