alferov/angular-file-saver

Download multiple files with a loop on Chrome 65

Opened this issue · 0 comments

Since Chrome 65
download several files with a loop launch only one download.

For instance :

                        angular.forEach(items, function (item) {
                                FileSaver.saveAs(item.data, item.name);
                        });

A workaround is to add a delay between each save :

                        var promise = $timeout();
                        angular.forEach(items, function (item) {
                            promise = promise.then(function () {
                                FileSaver.saveAs(item.data, item.name);
                                return $timeout(500);
                            });
                        });