Download file with a REST request needing headers and giving the content

后端 未结 4 825
甜味超标
甜味超标 2021-02-06 08:58

I am using AngularJs with a REST API. I don\'t have the hand on the REST API. I can store digital object with the API by sending a REST request. I can get it also with a GET req

4条回答
  •  不知归路
    2021-02-06 09:44

    I think you could using blob, something like

    var content=...the content of your request;
    var mypdf = new Blob(content, {type : 'application/pdf'});
    

    and check answer from "panzi" in this other question Using HTML5/Javascript to generate and save a file

    (One character per element in the array seem pretty nice binary. Probably you don't need to transform it. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data )

提交回复
热议问题