How to unzip a file without creating archive folder in nodejs?

Viewed 138

I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Currently, I am using the unzip module in Nodejs, using that I am able to create a directory by default called "myarchive" with the contents of the zip file. I do not want the code to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible? If so, then how. Thanks!

The function that I am currently using for unzipping is:

const extractArchive = async (inputFileName, extractToDirectory) => {
    fs.createReadStream(inputFileName)
        .pipe(unzip.Extract({
            path: extractToDirectory
        }));

PS: inputFileName is the path of the zip file(base directory in which zip is present+ the file name)

0 Answers
Related