adm-zip
adm-zip copied to clipboard
api toBufferPromise not expected
First of all, thank you for your contribution to this great project!
const admZip = new AdmZip()
await admZip.addLocalFolderPromise(path.resolve(__dirname, 'asd'), {})
await admZip.writeZipPromise(path.resolve(__dirname, '4.zip'))
console.log('contentHash1', getContentHash(await admZip.toBufferPromise())) // df15b1c7a53013d485dc6ee61e58cb10
console.log('contentHash2', getContentHash(await new AdmZip(path.resolve(__dirname, '4.zip')).toBufferPromise())) // 0a4af6c708af8e737e57e2d117f93985
console.log('contentHash3', getContentHash(await fse.readFile(path.resolve(__dirname, '4.zip')))) // 0a4af6c708af8e737e57e2d117f93985
Why is contentHash1 inconsistent with contentHash2 so that I have to bypass this API to avoid the problem?
I don't know how zip works, but I need to know the contentHash (Buffer) before the zip is formed, but with this library I have to print the ZIP and then read the Buffer in FS (because that's the only way Buffer is correct).
related to #440, I suspect