How to zip files using javascript
Copy link to clipboard
Copied
I want to zip a folder using java script. Is there a way to do it? How does the "Export for Digital Editions" do it (Since ePub is essentially a zip)?

Copy link to clipboard
Copied
Hi,
Try with following coding:
//----------------------------------------------
CreateZIP();
function CreateZIP(){
var fromFolder = Folder.selectDialog("Please Select The Folder to package as IDML");
if(!fromFolder)
{
return
}
var fullName = fromFolder.fullName;
var toZIPFile = new File( fullName+".zip" );
app.packageUCF( fromFolder, toZIPFile );
}
//----------------------------------------------
Thanks,
Praveen

Copy link to clipboard
Copied
app.packageUCF will work to create IDML files, but is not suited to make standard zip files. Don't ask me why, but it just doesn't work correctly with binary files.
Teus

