eligrey / eligrey/FileSaver.js
export 'saveAs' was not found in 'file-saver'
- Dominant language
- JavaScript
- Stars
- 22k
- Forks
- 4.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I have the message error "export 'saveAs' was not found in 'file-saver'"
That's strange, beacause I have
"file-saver": "^2.0.0-rc.2",
in my package.json,
and I have too the directory "file-saver" in my node_modules folder.
So I don't understand why I have this error message.
```
public download(fileName: string) {
fileName = 'learning-dataFR.txt';
console.log('%c upload fileName : ', 'color: blue; font-weight: bold;', fileName);
this.httpClient.get(environment.apiUrl + '/learning/download/' + fileName, { headers: this.httpHeaders, responseType: 'blob' })
.subscribe(blob => {
console.log('%c upload blob : ', 'color: blue; font-weight: bold;', blob);
this.saveFile(blob, 'zzz.txt');
});
}
```
```
public saveFile(blobContent: Blob, fileName: string) {
console.log('%c upload blobContent : ', 'color: green; font-weight: bold;', blobContent);
const blob = new Blob([blobContent], { type: 'application/octet-stream' });
console.log('%c upload fileName : ', 'color: green; font-weight: bold;', fileName);
saveAs(blob, fileName);
}
```
Thanks for your help
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.