zip parser + updated API #11

Merged
merged 16 commits into from Mar 14, 2012

Conversation

Projects
None yet
2 participants
Collaborator

dduponchel commented Feb 27, 2012

This is the result of my work on issue #7 : an implementation of a zip parser and an updated API. The API is heavily inspired by a comment of flying-sheep. The updated documentation is available on http://dduponchel.github.com/jszip/.
The parser support :

  • UTF8 in name/content
  • ZIP64
  • compression
  • data descriptors

I also updated the unit tests : they cover the new behaviors, the zip files are loaded with ajax calls (issue #6) and they all pass in every browsers (even in IE6).

dduponchel added some commits Oct 21, 2011

support for data descriptors + updated doc
In the load() method, adding support for data descriptors.
In the doc : documentation for data descriptors, added a paragraph
discussing the load() method, changed ID's of doc methods (W3C
compliant).
add tests for issue #7, use ajax (issue #6)
The ajax code has been tested in :
- IE 6 / 7 / 8 / 9
- the lastest firefox
- firefox 3.6
- the lastest opera
- the lastest chromium
- the lastest safari

The tests pass in all those browsers (except in IE 9 : the utf8 test was
broken, I didn't fixed it).
jszip-load : zip64 support (enhance issue #7)
Zip64 are generated for big files (> 4GiB, not really useful in a
browser) and when a stream is compressed (the zip utility doesn't know
the size, and uses zip64 for the worst case scenario).

Two other changes :
- The parser now read things backward (end of central dir, central dir,
  local files). Reading the file backward seems odd, but the zip format
  was designed to be read like that (and I have less troubles doing so).
- I also enforced the Stuk's coding style (to be coherent with the other
  files).
Don't always run tests on heavy files.
Parsing heavy files is interesting but can take a lot of resources (in
IE for example). Adding a switch to run them.
Unifying prototype definition.
Instead of
class.prototype.method1=...
class.prototype.method2=...
class.prototype.method3=...
We now have everywhere
class.prototype = {
  method1:...
  method2:...
  method3:...
}
Google closure compiler compliant.
Several changes :
- int, string, byte are reserved words, changing to readInt, etc
- updated @doc
Add a checkCRC32 param.
If true, this will recalculate the crc32 of each read file and check it
against the recorded value.

Also fix the crc 32 code to handle "" values.
Improve utf8 support.
Now supported : read/write utf8 in files, utf8 in path.

The unit tests all pass in :
- IE 6 / 7 / 8 / 9
- the lastest firefox
- firefox 3.6
- the lastest opera
- the lastest chromium
- the lastest safari
Browser support table.
The first (and only) table with browser compatibility was for the data
URI scheme (table full of restrictions and issues).
Now the first thing the user will see is where the library will work :
everywhere.

TODO : test in older browsers. IE and Firefox are good but
Opera/Safari/Chrome lack tests with old versions.
UTF8 : general purpose bit 11 + doc.
Handle utf8 in names only when this bit is set. Set this bit if the name
is in utf8.

Updated doc : add toText() and toBinary().
Owner

Stuk commented Mar 14, 2012

Absolutely perfect! Thanks very much :D

(Sorry if my coding style caused any problems :) I've now switched to the more conventional 4 spaces-tab)

Stuk added a commit that referenced this pull request Mar 14, 2012

@Stuk Stuk merged commit 75d7a29 into Stuk:master Mar 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment