Working on filesaver, while running SONAR QUBE it shows " 'fileSaver' is deprecated. use { autoBom: false } as the third argument "
this.http.get(`getTemplate/${doc.id}`, { responseType: 'blob' }).subscribe(
(data: any) => {
fileSaver.saveAs(new Blob([data], { type: this.fileType }), doc.docName)
error :- 'fileSaver' is deprecated. use { autoBom: false } as the third argument
Even if I use autobom:false it still shows the same
Here is the code for autobom
this.http.get(`getDocument/${doc.docId}`, { responseType: 'blob' }).subscribe(
(data: any) => {
var blob = new Blob([data], { type: this.fileType });
fileSaver.saveAs(blob, doc.docName,false);
'saveAs' is deprecated. use { autoBom: false } as the third argumentWhy is this an issue?
'fileSaver' is deprecated. use { autoBom: false } as the third argument Why is this an issue?
I had the same issue. I fixed by importing only the function.
For ts
import { saveAs } from 'file-saver';
saveAs(blob, doc.docName);
For js
const { saveAs } = require('file-saver');
I think that this sonar issue is because the browsers do not natively support interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With