I have a zip file which is a Visual Basic project. What I'm trying to see is if I can add my web app as a directory inside this zip archive so I can easily export my web apps as native windows apps
I tried the Ajax method from the documentation and it worked fine on my hard drive when loaded in Firefox, but it's not calling when from my website!
$(document).ready(function() {
$(".download").on("click", function() {
JSZipUtils.getBinaryContent('YourWinApp.zip', function(err, data) {
if(err) {
throw err; // or handle err
}
var zip = new JSZip(data);
zip.file("Hello.txt", "Hello World\n");
var folder = zip.folder("images");
folder.file("folder.txt", "I'm a file in a new folder");
var content = zip.generate({type:"blob"});
// see FileSaver.js
saveAs(content, "example.zip");
});
});
});
I have a zip file which is a Visual Basic project. What I'm trying to see is if I can add my web app as a directory inside this zip archive so I can easily export my web apps as native windows apps
I tried the Ajax method from the documentation and it worked fine on my hard drive when loaded in Firefox, but it's not calling when from my website!
$(document).ready(function() {
$(".download").on("click", function() {
JSZipUtils.getBinaryContent('YourWinApp.zip', function(err, data) {
if(err) {
throw err; // or handle err
}
var zip = new JSZip(data);
zip.file("Hello.txt", "Hello World\n");
var folder = zip.folder("images");
folder.file("folder.txt", "I'm a file in a new folder");
var content = zip.generate({type:"blob"});
// see FileSaver.js
saveAs(content, "example.zip");
});
});
});
Share
Improve this question
edited Feb 27, 2015 at 9:18
Michael Schwartz
asked Feb 26, 2015 at 8:47
Michael SchwartzMichael Schwartz
8,45514 gold badges90 silver badges153 bronze badges
3
-
How do you include it ? With the file in jszip
dist/
folder ? – David Duponchel Commented Feb 26, 2015 at 17:37 -
require is not defined
is the error. gee mayberequire
is not defined in your project? The tutorial probably uses RequireJS – Secret Commented Feb 27, 2015 at 5:07 - I got it to work on my hard drive locally on my machine, but doesn't call on my website. Can anyone help? – Michael Schwartz Commented Feb 27, 2015 at 9:20
1 Answer
Reset to default 5I tried the Ajax method from the documentation and it worked perfectly! (I didn't link to the right file lol)
$(document).ready(function() {
$(".download").on("click", function() {
JSZipUtils.getBinaryContent('YourWindowsApp.zip', function(err, data) {
if(err) {
throw err; // or handle err
}
var zip = new JSZip(data);
zip.file("Hello.txt", "Hello World\n");
var folder = zip.folder("images");
folder.file("folder.txt", "I'm a file in a new folder");
var content = zip.generate({type:"blob"});
// see FileSaver.js
saveAs(content, "example.zip");
});
});
});