adm-zip
adm-zip copied to clipboard
filename or path contains chinese characters
when filename or path contains chinese characters,the output zip file file name issue
Code:
var dic = /my dic path/
var zip = /my zip path/
var zip = new AdmZip();
zip.addLocalFolder(dic);
zip.writeZip(zip);

Can you try this.
#!/usr/bin/env node
var AdmZip = require('adm-zip');
var fpp = require('path');
function packer(folder, filepath){
var zip = new AdmZip();
zip.addLocalFolder(fpp.join(__dirname,folder));
// update file headers
zip.getEntries().forEach(entry => {
entry.header.flags |= 0x0800; // Set bit 11 - APP Note 4.4.4 Language encoding flag (EFS)
});
// save file (we generate our content again)
zip.writeZip(fpp.join(__dirname,filepath));
}
packer('./packme','./測試文件.zip');
It seems to working:

@5saviahv thanks!! it can work for me
Thanks! It works.
For the convenience of future people, I put my code up:
// pre
const zip = new AdmZip()
zip.addLocalFolder("dist/")
zip.writeZip(`dist/macao-${serverName}-${getTimeTag()}.zip`)
// after
const zip = new AdmZip()
zip.addLocalFolder("dist/")
zip.getEntries().forEach((entry) => {
entry.header.flags |= 0x0800
})
zip.writeZip(`dist/macao-${serverName}-${getTimeTag()}.zip`)
It should be default behaviour for now