Questions tagged [filesaver.js]

FileSaver.js implements the HTML5 W3C saveAs() FileSaver interface in browsers that do not natively support it

FileSaver.js is the solution to saving files on the client-side, and is perfect for web applications that need to generate files, or for saving sensitive information that shouldn't be sent to an external server.

316 questions
49
votes
4 answers

Download binary file with Axios

For example, downloading of PDF file: axios.get('/file.pdf', { responseType: 'arraybuffer', headers: { 'Accept': 'application/pdf' } }).then(response => { const blob = new Blob([response.data], { type:…
Anton Pelykh
  • 2,274
  • 1
  • 18
  • 21
29
votes
3 answers

import {saveAs} from 'file-saver': CommonJS or AMD dependencies can cause optimization bailouts

After upgrading to Angular 10, my download file-saver saveAs triggers the following compilation warning: CommonJS or AMD dependencies can cause optimization bailouts. The compiler also provides a link to an explanation and how to disable the…
Jan Nielsen
  • 10,892
  • 14
  • 65
  • 119
28
votes
3 answers

HTML5 File API downloading file from server and saving it in sandbox

I'm trying to understand HTML5 API. I'm designing the web application where the browser client need to download multiple files from server; user will perform something with the downloaded files and the application than need to save the state on user…
Mamadum
  • 530
  • 1
  • 9
  • 16
26
votes
5 answers

Generate an image of a div and Save as

I'd like to create an input button "Save image" that : take a screen shot of a div ask to "Save as" on the user's computer I've found how to create a screen of a dive using html2canvas and to open it in a new tab, it works perfectly : function…
Jaggana
  • 540
  • 1
  • 6
  • 15
22
votes
4 answers

Angular 2 Best approach to use FileSaver.js

I need to use the FileSaver.js (https://github.com/eligrey/FileSaver.js/) in my Angular2 application. I know I can add it as a script file in main html page and it will work. But I was wondering what would be the best approach in case of an Angular…
Naveed Ahmed
  • 10,048
  • 12
  • 46
  • 85
15
votes
2 answers

How to use Jest to test file download?

I have some code as below: /* global document */ /* global window */ /* global Blob */ import FileSaver from 'file-saver'; export const createDownloadFromBlob = (blob, filename, extension) => { FileSaver.saveAs(blob,…
zhuhan
  • 193
  • 1
  • 1
  • 8
14
votes
1 answer

Save file using binary string on Android via HTML5

I'm working with a small three-man team with my app and we're stuck. We're using JSZip and FileSaver to save files for our code editor application. It works fine in the browser, but when I use it with PhoneGap as a native Android application it…
Michael Schwartz
  • 8,153
  • 14
  • 81
  • 144
11
votes
3 answers

How to save Chart JS charts as image without black background using blobs and filesaver?

$("#NoBidsChart").get(0).toBlob(function(value) { saveAs(value, "Summary.jpg"); }); Here i am using Chart JS(v2.5.0) for rendering charts. When i try to export the charts using Canvas to Blob converter and filesaver.js, i get the black…
user7932844
  • 351
  • 1
  • 4
  • 12
11
votes
2 answers

save excel file using FileSaver.js

I am trying to export data to excel in angular js 1) User clicks a button 2) Data in $scope.myArray gets saved to excel file. I tried var blob = new Blob($scope.myArray , { type:…
Amit Kumar
  • 591
  • 2
  • 8
  • 24
11
votes
1 answer

JSpdf working in Internet Explorer but not working in Chrome

Hi I am a bit stuck here, trying to use jspdf for printing html to pdf. So first of all I tried with some examples and it worked. But when I try to implement the same in My Django Website, there is an issue. 1. Its working with Internet explorer, I…
coder3521
  • 2,608
  • 1
  • 28
  • 50
9
votes
1 answer

Saving PNG files with FileSaver.js

I'm trying to use FileSaver.js to download PNG files that are being served from my express app. The files are being sent as base64 encoded strings, but when I try to use FileSaver.js to save them they become corrupted. This is the way I'm trying to…
martin
  • 1,894
  • 4
  • 37
  • 69
8
votes
3 answers

Use Filesaver js with angular2

i have checked all the post i can find on the use of Filesaver JS with angular, but i still could not wrap my head around a soution. I added this to the map section of my system.config.js 'filesaver': 'node_modules/filesaver/src/Filesaver.js' I…
mayowa ogundele
  • 475
  • 2
  • 6
  • 19
8
votes
2 answers

Saving file on IE11 with FileSaver

I'm using FileSaver library ( https://github.com/eligrey/FileSaver.js) and does not work on IE11, with other browsers I had no problem. The code is this: var file = new File(["content"], "sample.xml", { type: "application/xml;charset=utf-8"…
rtrujillor
  • 1,162
  • 1
  • 12
  • 23
8
votes
2 answers

FileSaver.js with a Fabric canvas

I was trying to use FileSaver.js with a Fabric.canvas object, but it seems that Fabric js has no blob option. I'm using the Meteor framework by the way. How can I export a Fabric canvas without using the basic canvas.toDataUrl ?' Thanks :)
Ynnad
  • 303
  • 4
  • 18
8
votes
3 answers

download a pdf with filesaver.js and blob

I'm trying to download a file with Filesaver.js. And when I try to do this with csv, it works fine. But I need to download a pdf now. How can I do that? I use Filesaver.js with a blob object, my code looks something like this: var filename =…
madca0313
  • 81
  • 1
  • 1
  • 3
1
2 3
21 22