我是靠谱客的博主 犹豫石头,最近开发中收集的这篇文章主要介绍网页端压缩解压缩插件JSZIP库的使用,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

  JSZIP这个库支持在网页端生成zip格式的文件,  官方网站是:http://stuk.github.io/jszip/

  因为官方的API发生改变, 最新的DEMO如下:

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="http://stuk.github.io/jszip/dist/jszip.js"></script>
<script type="text/javascript" src="http://stuk.github.io/jszip-utils/dist/jszip-utils.js"></script>
<!--[if IE]>
<script type="text/javascript" src="http://stuk.github.io/jszip-utils/dist/jszip-utils-ie.js"></script>
<![endif]-->
<script src="http://stuk.github.io/jszip/test/jquery-1.8.3.min.js"></script>
<script src="http://stuk.github.io/jszip/vendor/FileSaver.js"></script>
</head>
<body>
<script>
var imgData = "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=";
var zip = new JSZip();
zip.file("Hello.txt", "Hello Worldn");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
zip.generateAsync({type:"blob"}).then(function(content) {
// see FileSaver.js
saveAs(content, "example.zip");
});
</script>
</body>
</html>

 

作者: NONO
出处:http://www.cnblogs.com/diligenceday/
QQ:287101329 

转载于:https://www.cnblogs.com/diligenceday/p/5017949.html

最后

以上就是犹豫石头为你收集整理的网页端压缩解压缩插件JSZIP库的使用的全部内容,希望文章能够帮你解决网页端压缩解压缩插件JSZIP库的使用所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部