Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip is not working #16

Closed
foobar321 opened this issue Feb 11, 2013 · 7 comments
Closed

Zip is not working #16

foobar321 opened this issue Feb 11, 2013 · 7 comments

Comments

@foobar321
Copy link

Hi,
I've just started using master version of your module and have found out that it is not possible to decompress created out.zip file from example/pack.js file (I've tried to get back test1.txt and test2.txt using 7-zip).
i was testing using NodeJs 0.8.14 and NodeJS 0.9.9 on Linux.
On NodeJS 0.8.14 I've got out.zip file size 931 bytes and on Node 0.9.9 I've got size 662 bytes.
I'm using async 0.2.5, lodash 0.10 and readeable-stream 0.2.0.
Can you please provide in pack.js example information (comment) about what is the expected output file size and MD5/SHA256 checksum?
Also can you provide an additional example without async library?

@ctalkington
Copy link
Member

def interesting that you get two different sizes. i actually use 7-zip to test the archives and the results under master pass its tests. I haven't tried out the examples fully yet so will make a note to do that. in regards to async, its pretty common to use with this module, but i will see about putting together an example now that we shouldn't need to wait on files before calling append or finalize.

@ctalkington
Copy link
Member

can you by chance provide the zips files you got? also MD5 and SHA really don't make sense because file dates vary.

@foobar321
Copy link
Author

Sure:

$ node --version
v0.8.19
$ stat out.zip 
  File: `out.zip'
  Size: 931         Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d  Inode: 1636845     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/  user)   Gid: ( 1000/  user)
Access: 2013-02-11 22:47:42.000000000 +0000
Modify: 2013-02-11 22:47:42.000000000 +0000
Change: 2013-02-11 22:48:08.760072278 +0000
 Birth: -
~/argh$ xxd out.zip 
0000000: 504b 0304 1400 0808 0800 f5b5 4b42 0000  PK..........KB..
0000010: 0000 0000 0000 0000 0000 0900 0000 6669  ..............fi
0000020: 6c65 312e 7478 7450 4b07 08a5 7594 3400  le1.txtPK...u.4.
0000030: 0000 0047 0400 0050 4b03 0414 0008 0808  ...G...PK.......
0000040: 00f5 b54b 4200 0000 0000 0000 0000 0000  ...KB...........
0000050: 0009 0000 0066 696c 6532 2e74 7874 7553  .....file2.txtuS
0000060: c991 1c31 0cfb 2b0a 46e0 28ec 1036 005a  ...1..+.F.(..6.Z
0000070: e28c 59a5 6b25 6a6a c237 75f5 b15b fbe9  ..Y.k%jj.7u..[..
0000080: 478b 0401 10fc ddb8 c28b 2263 009b 4248  G........."c..BH
0000090: 2e41 a15c e81f 4547 8505 2a47 8164 2d92  .A.\..EG..*G.d-.
00000a0: 4501 8e50 c901 460e bbed b3b1 a137 15cb  E..P..F......7..
00000b0: 82c2 2942 93fe 0fa8 0ad8 96d9 a1fe 9f30  ..)B...........0
00000c0: 2ff2 8ae8 f16f 2a3a 56eb a801 7528 9b62  /....o*:V...u(.b
00000d0: 252b 24ad 0006 1223 1472 2ada 2563 dea3  %+$....#.r*.%c..
00000e0: 3d19 076c 0576 701b 77a7 ab88 afe4 5bd6  =..l.vp.w.....[.
00000f0: 479a 935a 30e8 f9b3 21b8 e415 934b 2b04  G..Z0...!....K+.
0000100: 019f 1161 3df4 9187 fc51 45f3 89f3 f13b  ...a=....QE....;
0000110: a62a a539 b330 e1cf db52 1652 c28b dc44  .*.9.0...R.R...D
0000120: bf51 5b3d 9bc7 d23f 5444 ae6c 4e0c f535  .Q[=...?TD.lN..5
0000130: 7077 a236 f569 78b2 78e4 92d8 5194 e1c5  pw.6.ix.x...Q...
0000140: b7ed c4e6 3d76 4bfa 46cc fd6d 12ea 05c1  ....=vK.F..m....
0000150: 2618 a3bb 9796 bd57 2ee8 382b 07cb f1f9  &......W..8+....
0000160: 0573 2937 bbf3 cad2 b263 d729 dae6 331e  .s)7.....c.)..3.
0000170: 264d 6163 8bea a7dc c089 5b55 070d d54a  &Mac......[U...J
0000180: 303e 8bc1 76f6 5abc b233 2c9a fcd7 8a8e  0>..v.Z..3,.....
0000190: 245d 4c1b 36ad a4a8 811f f245 88a3 4aa5  $]L.6......E..J.
00001a0: 933d 13b1 f2db 3bcd 450d f64c ddca 8e27  .=....;.E..L...'
00001b0: 3a03 7bea fb90 bd9e b3d2 4c13 b66b 739d  :.{.......L..ks.
00001c0: 7dcd 23e8 d758 5c79 1f97 354e 6a87 6c9d  }.#..X\y..5Nj.l.
00001d0: d6ad 4ba9 ffb0 897d 6384 3bdc c9fb bd48  ..K....}c.;....H
00001e0: 34e9 f150 73f1 f0fb 2aee 7d3b bd99 a6bb  4..Ps...*.};....
00001f0: 026d 98b7 92b1 68cc 5b99 8bdc 91ee 9a7f  .m....h.[.......
0000200: 99ff 504b 0708 77f4 f35d 0000 0000 bf01  ..PK..w..]......
0000210: 0000 504b 0102 1400 1400 0808 0800 f5b5  ..PK............
0000220: 4b42 a575 9434 a401 0000 4704 0000 0900  KB.u.4....G.....
0000230: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000240: 6669 6c65 312e 7478 7450 4b01 0214 0014  file1.txtPK.....
0000250: 0008 0808 00f5 b54b 4277 f4f3 5d00 0000  .......KBw..]...
0000260: 00bf 0100 0009 0000 0000 0000 0000 0000  ................
0000270: 0000 0037 0000 0066 696c 6532 2e74 7874  ...7...file2.txt
0000280: 504b 0506 0000 0000 0200 0200 6e00 0000  PK..........n...
0000290: 1202 0000 0000 3590 c171 4331 0844 efbf  ......5..qC1.D..
00002a0: 8a2d c0e3 2a92 5bae 2980 48d8 6146 1232  .-..*.[.).H.aF.2
00002b0: 028f cb0f ca4f 6e42 c0b2 fb3e d4b8 43e6  .....OnB...>..C.
00002c0: 8a8e aa4d 0d4b 1cd4 d92f 283a 1617 670f  ...M.K.../(:..g.
00002d0: 0355 99b2 a4c8 b883 9b64 7771 cd0d b0c4  .U.......dwq....
00002e0: ea5a e1dc a7da 21a3 4895 1ac3 118e 465f  .Z....!.H.....F_
00002f0: a90f f653 9bd1 e93e 08d4 e411 74c5 a783  ...S...>....t...
0000300: 87f4 1447 97fd 7866 49fd 8247 c83a 862e  ...G..xfI..G.:..
0000310: b7a8 e017 5b11 2717 1d88 d6a8 173d 9565  ....[.'......=.e
0000320: 61a4 a97d e957 5266 0e83 299d f7f4 a467  a..}.WRf..)....g
0000330: 823c e5d7 e32d 2541 e10c b148 2767 5819  .<...-%A...H'gX.
0000340: 309e c6df 3c2a 5b26 cf8f a7b6 9879 8ed3  0...<*[&.....y..
0000350: 4e26 05af c528 d2da 3fa2 0c14 c72d ee42  N&...(..?....-.B
0000360: 8eb1 0d61 9265 1176 c5fb abf0 748e cd31  ...a.e.v....t..1
0000370: 1968 29c4 25e7 4a4c a9e4 7b23 534c 53a9  .h).%.JL..{#SLS.
0000380: 3c36 c54d 4ac6 51a2 4dda b9a1 b75b 6226  <6.MJ.Q.M....[b&
0000390: 545e 6cbb dbb5 6d1b b401 49e2 587f 5ca3  T^l...m...I.X.\.
00003a0: 5f8f 1f                                  _..
~/argh$ 7z e out.zip 

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Processing archive: out.zip

Extracting  file1.txt     Data Error
Extracting  file2.txt     Data Error

Sub items Errors: 2

And both files are 0 bytes long.

@ctalkington
Copy link
Member

thanks. there is a PR and some changes coming to examples until then i'd recommend using v0.3 for production. but thanks for the heads up.

@ctalkington
Copy link
Member

have been able to recreate this. appears to be something with multiple files and zip, tar example passes all 7zip tests.. will investigate further.

@ctalkington
Copy link
Member

def think this is an issue with the change to way it handles streams asap. cause its only streams (with multiple in zips) that don't appear to properly work.

@ctalkington
Copy link
Member

ok, if you could give latest version a go.

basically, the issue had to do with the change to making zip push to buffer asap when using streams. what it was doing was calling deflate and the callbacks would sometimes not fire in order causing a corrupt file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants