0

I am using Angular and FileSaver to save a file but I want to specify a name to the downloaded file

this._UsersService.downloadReport(id).subscribe(data => {
  FileSaver.saveAs(data);
});
Osama Amr
  • 19
  • 4
  • Read the documentation? `FileSaver saveAs(Blob/File/Url, optional DOMString filename, optional Object { autoBom })`. The second argument is the file name – Jeremy Thille Jan 19 '22 at 15:30

1 Answers1

2

Not too familiar with it, but wouldn't you just add a file name option after your data?

ex: FileSaver.saveAs(data, "my filename") ?

https://github.com/eligrey/FileSaver.js/

Edit: perhaps another relevant SO post: How to use filesaver.js

SomeStudent
  • 2,856
  • 1
  • 22
  • 36