title: Retrieve binary data without using arraybuffer
body: <p>I have the following resource:</p>
  
  <pre><code>function _arrayBufferToBase64(buffer) {
      var binary = '';
      var bytes = new Uint8Array(buffer);
      var len = bytes.byteLength;
      for (var i = 0; i &lt; len; i++) {
          binary += String.fromCharCode(bytes[ i ]);
      }
      return window.btoa(binary);
  }
  
  var API = $resource(server + 'album', {}, {
      get: {
          url: server + 'album/:albumId/photo/:photoId',
          method: 'GET',
          responseType: 'arraybuffer',
          headers: {
              'AuthToken': 'the secret',
              'Accept': 'image/*'
          },
          interceptor: {
              response: function(resp) {              
                  return 'data:'+ resp.headers('Content-Type') + ';base64,' + _arrayBufferToBase64(resp.data)};
              }
          }
      }
  });
  </code></pre>
  
  <p>what it does is to receive the binary content of the file from server and return a data uri with the base64 data inside.</p>
  
  <p>I have to say that this call can not be replaced with a simple src tag to the url as there are some authentication headers sent too.</p>
  
  <p>this works fine in newer browsers but I want to keep compatibility with older browsers, so the arraybuffer is a problem here, my question is: is there a way to do all these without arraybuffer? </p>
  
  <p>I tried to remove the response type and convert the string in resp.data using what is described <a href="https://stackoverflow.com/questions/1240408/reading-bytes-from-a-javascript-string">here</a> but no success.</p>