Zipping files with javascript - corrupt archive
I'm trying to use [JSZip][1] to zip some text and then open it with [7Zip][2]. The problem is, the archive is apparently corrupted at some point. I can't open it. I'm guessing it's not created correctly, possibly because I'm not using the correct encoding,  but there could also be a slight chance that it's happening during transfer from my Android device (this is a [Phonegap][3] project) to my PC (I use adb to transfer the archive).

My code is:

    var zip = new JSZip();
    zip.add("hi.txt", "Hello World");
    var content = zip.generate(true); // true == get raw byte string
    writer.write(content);

Where `writer` is a Phonegap [FileWriter][4] object. 

Any ideas?


  [1]: http://jszip.stuartk.co.uk/
  [2]: http://www.7-zip.org/
  [3]: http://www.phonegap.com
  [4]: http://docs.phonegap.com/en/1.3.0/phonegap_file_file.md.html#FileWriter
Zipping files with javascript - corrupt archive
===

I'm trying to use [JSZip][1] to zip some text and then open it with [7Zip][2]. The problem is, the archive is apparently corrupted at some point. I can't open it. I'm guessing it's not created correctly, possibly because I'm not using the correct encoding,  but there could also be a slight chance that it's happening during transfer from my Android device (this is a [Phonegap][3] project) to my PC (I use adb to transfer the archive).

My code is:

    var zip = new JSZip();
    zip.add("hi.txt", "Hello World");
    var content = zip.generate(true); // true == get raw byte string
    writer.write(content);

Where `writer` is a Phonegap [FileWriter][4] object. 

Any ideas?


  [1]: http://jszip.stuartk.co.uk/
  [2]: http://www.7-zip.org/
  [3]: http://www.phonegap.com
  [4]: http://docs.phonegap.com/en/1.3.0/phonegap_file_file.md.html#FileWriter