आप इसके लिए zip.js का उपयोग कर सकते हैं। इसमें पहले से ही HTTP (सीएफ zip.HttpReader कन्स्ट्रक्टर) से ज़िपित करने के लिए एपीआई है और एचटीएमएल 5 फाइल सिस्टम (सीएफ zip.FileWriter कन्स्ट्रक्टर) पर जेनरेट ज़िप लिखने के लिए है।
index.html
फ़ाइल:
यहाँ filesystem API का उपयोग कर एक उदाहरण है
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Zip JSON data from the BBC into HTML5 FileSystem</title>
</head>
<body>
<script src="zip.js"></script>
<script src="zip-fs.js"></script>
<script src="zip-ext.js"></script>
<script src="example.js"></script>
</body>
</html>
example.js
फ़ाइल:
// create a zip virtual filesystem
var fs = new zip.fs.FS();
// add some files into the zip filesystem
// add the "bbc-music.json" file in the root directory
fs.root.addHttpContent("bbc-music.json",
"http://www.bbc.co.uk/programmes/genres/music.json");
// add the "bbc-learning.json" file in the root directory
fs.root.addHttpContent("bbc-learning.json",
"http://www.bbc.co.uk/programmes/genres/learning.json");
// create a file named "test.zip" in the root directory of the HTML5 filesystem
createFile("test.zip", function(fileEntry) {
// export the zip content into "test.zip" file
fs.root.exportFileEntry(fileEntry, function() {
console.log("done");
});
});
// function to create a file in the HTML5 temporary filesystem
function createFile(filename, callback) {
webkitRequestFileSystem(TEMPORARY, 4 * 1024 * 1024, function(fs) {
fs.root.getFile(filename, { create : true }, callback);
});
}
स्रोत
2013-01-06 12:48:58
आप एक पृष्ठ में सभी 'resources' की सामग्री के लिए उपयोग किया जा सकता है (छवियों, जेएस \ सीएसएस फाइल आदि) मुझे जेएस – Sudarshan