admin管理员组文章数量:1391987
I am using EXT JS 4.2 which has a panel which contains a export to CSV button.
On clicking on it multiple (total six) files are downloaded. I want these files to be downloaded in a single ZIP file.
I am using EXT JS 4.2 which has a panel which contains a export to CSV button.
On clicking on it multiple (total six) files are downloaded. I want these files to be downloaded in a single ZIP file.
Share Improve this question edited Feb 3, 2017 at 17:00 Prateek Ratnaker asked Feb 23, 2016 at 14:12 Prateek RatnakerPrateek Ratnaker 8171 gold badge11 silver badges35 bronze badges 2- Have you tried to create a folder using JSZip? – André Bonna Commented Feb 23, 2016 at 18:34
- I created a JSFiddle that works. Hope it helps! – André Bonna Commented Feb 23, 2016 at 20:10
1 Answer
Reset to default 6There is a perfect plugin to create zip files inside browser.
JSZip: https://stuk.github.io/jszip/
Install the plugin by adding js files manually:
download JSZip and include the file dist/jszip.js or dist/jszip.min.js
JSFiddle - JSZip 3.0:
https://jsfiddle/andrebonna/u8zsbzau/
var zip = new JSZip();
for (var i = 0; i < 5; i++) {
var CSV = 'CSV_content';
// Fill CSV variable
zip.file("file" + i + ".csv", CSV);
}
zip.generateAsync({
type: "base64"
}).then(function(content) {
window.location.href = "data:application/zip;base64," + content;
});
本文标签: extjsDownloading multiple files into a Zip file Javascript using data URIStack Overflow
版权声明:本文标题:extjs - Downloading multiple files into a Zip file Javascript using data URI - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744663036a2618362.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论