node-archiver icon indicating copy to clipboard operation
node-archiver copied to clipboard

Produce the same zip file all time

Open AlttiRi opened this issue 1 year ago • 3 comments

Currently, the hash of each zip archive is unique. Seems, archiver adds the archiving time in the zip file.

Is it possibly to skip this? I need the reproducible result.

For example, 7zip always generates the same zips for the same input.


I use that:

export async function zipDirectory(sourceDir, outPath) {
    const archive = archiver("zip");
    const writeStream = fs.createWriteStream(outPath);
    const readStream = archive.directory(sourceDir, "");
    await archive.finalize();
    await pipeline(readStream, writeStream);
}

AlttiRi avatar May 05 '24 21:05 AlttiRi

Alternatively, I would like to have an ability to get the result zip's CRC hash of the data inside it. I assume archiver computes this, but just not exposes.

AlttiRi avatar May 05 '24 21:05 AlttiRi

@AlttiRi Did you figure this out?

Probotect0r avatar Oct 11 '24 06:10 Probotect0r