Closed albertogasparin closed 8 years ago
that's a neat idea. as download.js evolved, that was never considered because Blob support was shaky for a long time, and people's expectations about file size had been modest. It never converted a format unless it had to because of lack-of-support. I could easily close this out and say "not my problem", as it is a limit of dataURLs and/or browsers, but that won't help anyone. Indeed, it SHOULD be possible to convert long dataURLs into window.URLs and download them that way. I think the pieces are even there now (ex d2b()). thanks for the idea, and watch this space; i will try ti out and if workable, fold it into the next release. thanks again!
aside: you might want to use HTMLCanvasElement.prototype.toBlob
instead of HTMLCanvasElement.prototype.toDataURL
to save the user-land conversion overhead, it works in FF+Ch now...
Yes, I know, but I will need a polyfill for Safari and IE. So having one plugin that does the job regardless the format is nicer. You are right, your lib already has all the bits and pieces. I did a quick test and by converting base64 strings longer than 2MB to Blob does the job.
Maybe you can also evaluate the opportunity to make Blob the default way. It has great browser support nowadays (IE10+)
i forgot to mention this was fixed: https://github.com/rndme/download/commit/8dfadcddb0f9091c8a7f2983a392be168613154b
thanks for the idea!
This is quite an old bug but it looks like it has not been resolved yet. Basically when I try to use your plugin to download a base64 that is bigger than several MB (from a
canvas
), I get "network error" instead of the proper file. Probably you should switch to Blob if the base64 string is too long.