Created
November 22, 2019 09:39
-
-
Save apal21/0623a8e4a68e23e233fb9794fcc867cd to your computer and use it in GitHub Desktop.
Open Password protected file in Node.js using unzipper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const unzipper = require('unzipper'); | |
(async () => { | |
try { | |
const directory = await unzipper.Open.file('path/to/your.zip'); | |
const extracted = await directory.files[0].buffer('PASSWORD'); | |
// If the extracted entity is a file, | |
// converting the extracted buffer to string would print the file content | |
console.log(extracted.toString()); | |
} catch(e) { | |
console.log(e); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will it allow me to open .7z?