I do a WinJS.xhr() call with a responseType of "blob" and the result.response is an image. How do I share that image? The DataTransferManager's setBitmap wants a streamreference. Do I need to record the image to a temporary file and then do a Windows.Storage.Streams.RandomAccessStreamReference.createFromFile()
? If so, how do I write the image to a StorageFile? Thanks.
You have two choices:
The second option stops you from having to write the file to disk if your just sharing it temporarily, but it does some with some memory management to revoke the blob later. With the URL created, you can just assign it to the an img
tags src
attribute.