Skip to content

Instantly share code, notes, and snippets.

@apal21
Created November 22, 2019 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apal21/0623a8e4a68e23e233fb9794fcc867cd to your computer and use it in GitHub Desktop.
Save apal21/0623a8e4a68e23e233fb9794fcc867cd to your computer and use it in GitHub Desktop.
Open Password protected file in Node.js using unzipper
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);
}
})();
@RamK8055
Copy link

Will it allow me to open .7z?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment