7

I am using the file-saver to save a file on client browser. However the file is directly getting downloaded.

const blob = new Blob([data.body], {type: 'application/'pdf});
  FileSaver.saveAs(blob, 'export.pdf')

How to prompt the "Save As" window so user can save it with their own name and location.

I have seen a few answers on changing the settings in the browser, but wanted to know if file-saver has an api or any tweak in the code can prompt the window.

Note:- There aren't many resources on file-saver Save As API ( If not for browser settings.

prabhat gundepalli
  • 907
  • 3
  • 15
  • 39

1 Answers1

0
const mediaType = 'application/pdf';
const blob = new Blob([value], { type: mediaType });
const url= window.URL.createObjectURL(blob);
window.open(url);
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Gabor Sandor
  • 53
  • 2
  • 8