Filesaver.js: ERROR TypeError: Object(...) is not a function

Created on 21 Mar 2018  路  3Comments  路  Source: eligrey/FileSaver.js

I'm using "file-saver": "^1.3.4", "@angular/cli": "1.6.7", and Angular 5.

Following the documentation usage:

import {saveAs} from 'file-saver';

const blob = new Blob(results, {type: "text/plain;charset=utf-8"});
saveAs(blob, 'file.db');

I'm getting the error:

ERROR TypeError: Object(...) is not a function

EDIT: I noticed that the issue is related to version 1.3.4. After downgrading to 1.3.3 I'm now able to download the file.

Most helpful comment

Thank, you, for your response, but I think, it should be considered as breaking change, therefore the version should change properly.

All 3 comments

+1
I can confirm the same issue.

see #414

In v1.3.4, the syntax changed. You will need to do

import FileSaver from "file-saver"

FileSaver(blob, "filename.pdf")

Thank, you, for your response, but I think, it should be considered as breaking change, therefore the version should change properly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

meenucoditas picture meenucoditas  路  6Comments

Toterbiber picture Toterbiber  路  5Comments

MFEKN picture MFEKN  路  5Comments

josepoma picture josepoma  路  4Comments

HeroSony picture HeroSony  路  5Comments