windows runtime - Convert data URL (of type blob://xxx) to IRandomAccessStream -


i have internal api (that have no control over) returns url of image. inspected url , noticed it's has following format:

blob://xxxxxxxx 

i use url value img.src in code, , displays image perfectly. now, i'd convert url irandomaccessstream object can call internal api.

i tried following:

var uri = new windows.foundation.uri(imgurl); var streamref = randomaccessstreamreference.createfromuri(uri); streamref.openreadasync(function (stream) {     // stream of type irandomaccessstream     // make internal api call here }, error); 

however, "not implemented" error message in error handler function openreadasync call.

is there way convert blob url irandomaccessstream?

following code give access blob object url of format (blob:b0939e98-128b-4ba3-b8d6-b499e7f6c612). per w3 file api spec section 12.7.

// url example: blob:b0939e98-128b-4ba3-b8d6-b499e7f6c612 winjs.xhr({ url: url, responsetype: 'blob'}).then(function (req) {     var blob = req.response; }).then(null, function onerror() {     // handle error }); 

after using filereader api, can read contents of blob. mozilla doc link filereader api. if there specific reason build irandomaccessstream, need explorer converting blob object irandomaccessstream.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -