Loading a buffer into an AdmZip object

105 Views Asked by At

i'm trying to load a buffer to AdmZip object, in TypeScript and it doesn' work. My buffer is a zip archive of 3 files, in this example.

exctractZippedContentBufferToDirectory(buffer: Buffer, destinationPath: string): void {
    fs.writeFileSync("myFile.zip", buffer);
    const admZip = new AdmZip('myFile.zip');
    console.log(admZip.getEntryCount()); //=> 3, OK works

    const admZip2 = new AdmZip(buffer);
    console.log(admZip2.getEntryCount()); //=> 0, doen't work
}
0

There are 0 best solutions below