Set Dateiname beim Download via blob in Winkel-5

Unten ist mein Typoskript-code für den download-Datei Vom API -

DownloadLM() {
var ID= sessionStorage.getItem("UserID");
    return this.http.get(this.baseurl + 'api/DownloadFiles/DownloadLM/' + ID,
      {
        headers: {
          'Content-Type': 'application/json'
        },
        responseType: 'arraybuffer'
      }
    )
      .subscribe(respData => {
        this.downLoad(respData, this.type);
      }, error => {
      });
  }

  downLoad(data: any, type: string) {
    var blob = new Blob([data], { type: type.toString() });
    var url = window.URL.createObjectURL(blob);
    var pwa = window.open(url);
    if (!pwa || pwa.closed || typeof pwa.closed == 'undefined') {
      alert('Please disable your Pop-up blocker and try again.');
    }
  }

Dies ist gut, um download Excel-Datei , aber es gibt einen zufälligen Namen für die Datei, die ich nicht will , ich will, die Datei Namen meiner Wahl, wenn es herunterladen ,

Wo kann ich einstellen, dass Datei-name hier ? jede Eigenschaft der Blob ?

InformationsquelleAutor Tanwer | 2018-08-22
Schreibe einen Kommentar