Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to zip files using javascript

New Here ,
May 05, 2010 May 05, 2010

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)?

TOPICS
Scripting
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 07, 2010 May 07, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 07, 2010 May 07, 2010
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines