2 Replies Latest reply on May 7, 2010 12:44 PM by Teus de Jong

    How to zip files using javascript

    PinalV

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

        • 1. Re: How to zip files using javascript
          Praveen10 Level 1

          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

          • 2. Re: How to zip files using javascript
            Teus de Jong

            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