[SOLVED]Using File-saver.js with Ember-cli


#1

Hi, all! I would like to use FileSaver.js with my ember-cli project for saving Canvas to PNG.

I download Blob.js, canvas-toBlob.js and FileSaver.js then import it in Brocfile.js

app.import('vendor/Blob.js');
app.import('vendor/canvas-toBlob.js');
app.import('vendor/FileSaver.min.js');

In my controller I save canvas by this way:

$('.canvas')[0].toBlob (blob) =>
      saveAs blob, "#{fullName}_ID_Badge.png".underscore()

It’s fully working with Chrome and Firefox, but IE still not working. Always show:

SCRIPT5022: SecurityError

I have tried to import FileSaver like this:

app.import('vendor/FileSaver.min.js', {
      'file-saver': ['saveAs']
});

But when I tried in controller

`import saveAs from 'file-saver'`

they sad me “Module file-saver could not found”

Is there any solutions to save canvas in IE without server-side processing?

UPD. SOLVED: IE cannot save canvas if you draw SVG. It was not problem of Ember or FileSaver.js


#2

This sounds more like an IE issue with file saver than an ember issue. Have you tried filing an issue on that project?


#3

File-saver supports IE10+, but I think some of this libraries was imported wrong to my project. UPD. Demo working in IE http://eligrey.com/demos/FileSaver.js/