eligrey / eligrey/FileSaver.js

createObjectURL no function was found that matched signature provided

Open
#611 7 comments 8 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

Hi guys,

As the title said I'm trying to use the function saveAs to download files from urls. For the sake of clarity I like to start coding by testable and working examples, so I've used the one on the README.md.

Angular version: 6
My function looks like this:

```
public downloadFile(file: Filesmodel): void {
saveAs('https://httpbin.org/image', 'image.jpg');
}
```

The logs:
```
FileDialogComponent.html:52 ERROR TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
at new FileSaver (FileSaver.js:127)
at saveAs (FileSaver.js:143)
at FilesService../src/app/services/files.service.ts.FilesService.downloadFile (files.service.ts:47)
at FileDialogComponent../src/app/components/patients/upload-files/file-dialog/file-dialog.component.ts.FileDialogComponent.downloadFile (file-dialog.component.ts:42)
at Object.eval [as handleEvent] (FileDialogComponent.html:53)
at handleEvent (core.js:10259)
at callWithDebugContext (core.js:11352)
at Object.debugHandleEvent [as handleEvent] (core.js:11055)
at dispatchEvent (core.js:7718)
at core.js:8162
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.