angular-file-saver icon indicating copy to clipboard operation
angular-file-saver copied to clipboard

Download multiple files with a loop on Chrome 65

Open stephanebouget opened this issue 6 years ago • 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);
                            });
                        });

stephanebouget avatar Mar 28 '18 08:03 stephanebouget