node.js file-saver problem with saveas function

Viewed 341

I have got an issue with file-saver when I save a file. The file is a canvas, and when I save with saveAs function is not working and return an error.

This is the code:

    function SaveIngotClient() {
      c.toBlob(function(blob) {
        saveAs(blob, "test.png");
      });
    }

I've exported file-saver with html tag:

<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.js"></script>

This is the code for create the canvas:

    var c = document.getElementById("GeneratedIngot");
    var ctx = c.getContext("2d");

And finally, this is the error:

Uncaught ReferenceError: saveAs is not defined
    at index.html:293

How I can fix it? Thanks and sorry for the bad English! P.S is a Electron application

0 Answers
Related