daily pastebin goal
81%
SHARE
TWEET

Untitled

a guest May 16th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let apiUrl = "./assets/test.bin";
  2. const headers = {
  3.   headers: new HttpHeaders({responseType: "application/octet-stream"})
  4. };
  5.  
  6. let data : Observable<Uint8Array> = this.http.get<Uint8Array>(apiUrl, headers);
  7. data.subscribe( (response: Uint8Array) => {
  8.   const data = response;
  9.   // console.log(data);
  10.   console.log("successful");
  11.  
  12.   return data;
  13. }, (error : HttpErrorResponse)=> {
  14.   console.log(error.error.text);      
  15. });
  16.    
  17. let apiUrl = "./assets/test.bin";
  18. const headers = {responseType: "blob"};
  19.  
  20. let data : Observable<Blob> = this.http.get<Blob>(apiUrl, headers);
  21. data.subscribe( (response: Blob) => {
  22.   const data = response;
  23.   console.log(data);
  24. }, (error : HttpErrorResponse)=> {
  25.   console.log(error.error.text);      
  26. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top