Ionic 4 angular downloaded file using http get not exist

i use http Angular in ionic 4 for download file according this tutorial

progress did correct and it up to 100% and get Done message but downloaded file not exist

The Code :

download(url) {
    let req = new HttpRequest("GET", url, {
      responseType: "arraybuffer",
      reportProgress: true

    return this.http.request(req).pipe(
      map(event => this.getStatusMessage(event)),
      tap(message => console.log(message)),

  getStatusMessage(event) {
    let status;
    switch (event.type) {
      case HttpEventType.Sent:
        return `Uploading Files`;

      case HttpEventType.DownloadProgress:
        status = Math.round((100 * event.loaded) /;; // NOTE: The Content-Length header must be set on the server to calculate this
        return `Files are ${status}% downloaded`;

      case HttpEventType.Response:
        return `Done`;

        return `Something went wrong`;

Code in page:

newDownload(url) {
      .subscribe(data => {

    this.api.downloadProgress.subscribe(progress => {
      this.testprog = progress;

and data is “Done”

Can you please share how the stuff in what you have posted already is being called? I specifically would like to see something with the word “subscribe” in it.

1 Like

question updated. the subscribe part code added

I think the problem is that your map operator is throwing the actual download results in the trash can.

Your initial request is asking for an ArrayBuffer, and that should be what is coming in the body property of the final HttpEventResponse. However, you’re mapping that event to pay attention only to the event type, and returning just the string Done, so by the time we get past that map the original event with its precious cargo has been tossed aside.