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

addFile: cannot create a directory

Open warpdesign opened this issue 7 years ago • 2 comments

From the API documentation:

If you want to create a directory the entryName must end in / and a null buffer should be provided.

When typing this zip.addFile('myDir/', null), I'm getting this error:

node_modules\adm-zip\adm-zip.js:280 if (entry.isDirectory && content.length) { ^ TypeError: Cannot read property 'length' of null

warpdesign avatar Feb 24 '17 11:02 warpdesign

This here works for me:

const zip = new AdmZip();
zip.addFile('dirname/', new Buffer(''));

ivome avatar Aug 13 '17 00:08 ivome

Almost 4 years later, this hasn't been fixed...

seanpmaxwell avatar Dec 18 '20 06:12 seanpmaxwell