Bug Tracker

Opened 11 years ago

Closed 11 years ago

#9992 closed feature (patchwelcome)

$.get binary

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: ajax Version: 1.6.2
Keywords: Cc: jaubourg
Blocked by: Blocking:

Description (last modified by jaubourg)

it would be nice if we could get "arraybuffer" or "blob" response type from ajax request.
it seems direct "blob" response is not yet supported by all browser (chrome don't) but we can easily build it from arraybuffer:

var xhr=new XMLHttpRequest();
    if (this.status==200){
        var bb=new BlobBuilder();
        var blob=bb.getBlob());

Change History (3)

comment:1 Changed 11 years ago by timmywil

Cc: jaubourg added
Component: unfiledajax
Priority: undecidedlow

I think this is best implemented with a converter, but I'll defer to jaubourg.

comment:2 Changed 11 years ago by jaubourg

Description: modified (diff)

Maybe it could be implemented using a "text bin" converter. You'd need a prefilter for bin requests to add responseType: "arraybuffey" into options.xhrFields though. And that's provided xhr.responseText === xhr.response which I'm really not sure about.

So, this may require changes in the xhr transport... but I'm unsure if this is already "standard" enough (ie. not requiring insane jumping through hoops).

comment:3 Changed 11 years ago by dmethvin

Resolution: patchwelcome
Status: newclosed

Sounds like this should start life as a converter, outside core. If it's popular we can incorporate it.

Note: See TracTickets for help on using tickets.