adm-zip icon indicating copy to clipboard operation
adm-zip copied to clipboard

TypeError: "size" argument must be a number

Open Yirou opened this issue 7 years ago • 5 comments

I have this error on generate zip. After some researches, i found that it's compress function. So, in zipFile line 270, I replaced var postHeader = Buffer.alloc(name); by var postHeader = Buffer.alloc(name.length,name) to fix this error;

I don't know if it's my node version or not. I use node 8.11.2

Yirou avatar May 28 '18 07:05 Yirou

I have the same issue on node v9.8.0. That change also seems to fix the issue there.

ivome avatar Jun 05 '18 20:06 ivome

I have the same issue on node v8.11.3. That change fixed issue.

mmihic96 avatar Jun 21 '18 06:06 mmihic96

Note that Buffer.from(name) also seems like it should fix the issue.

bolinfest avatar Aug 08 '18 21:08 bolinfest

It looks like PRs to fix the issue have already been filed:

https://github.com/cthackers/adm-zip/pull/234 https://github.com/cthackers/adm-zip/pull/239

bolinfest avatar Aug 08 '18 21:08 bolinfest

@cthackers It appears that the adm-zip<0.4.11 has a "high severity" vulnerability: https://snyk.io/vuln/npm:adm-zip:20180415; however, switching to 0.4.11 (we updated from 0.4.7: https://github.com/facebook/nuclide/commit/276f47aed6a62fa60443a8303a95a1101f453406) introduces this bug, so could we please get a new release with this bug fixed so we can upgrade to a secure version?

bolinfest avatar Aug 08 '18 22:08 bolinfest