i'm using aws sdk generate pre-signed download url s3 , and have done part. can copy generated pre-signed url browser , chrome automatically download file.
i want achieve same thing in angular2, simulate clicking link. wrote following code:
app.component.ts
public downloadfile() { this.downloadservice.downloadfile(this.downloadlink) .subscribe((response) => { console.log(response); });}
download.service.ts
public downloadfile(downloadlink: string) { return this.http.get(downloadlink) .map((response) => { return response; }); }
it indeed printed out file content in console didn't trigger downloading. has got idea what's correct way it?
thanks,
here example download csv file change mime type own file.
public downloadfile(downloadlink: string) { return this.http.get(downloadlink) .map((response) => { let blob = new blob([response], { type: 'text/csv' }); let url= window.url.createobjecturl(blob); window.open(url); }); }
In this article, we discuss Download multiple files using S3 pre-signed URL in my Angular Application
ReplyDeletehttps://www.thestackoverflow.com/question/download-multiple-files-using-s3-pre-signed-url-in-my-angular-application/