English | 中文
Unzip chrome extension files
If you want to unzip Chrome extension files (*.crx) you might have the problem that your unzip lib claims that the file header is malformed. This is due to that Chrome adds some extra information for identifying crx files. unzip-crx
handles those additional headers and unzips as usual.
This library is based on Peerigon's unzip-crx, which makes simple modifications and adds esm
and cjs
support.
And this unzip-crx is highly inspired by crx2ff from abarreir and crxviewer from Rob Wu, thanks!
# pnpm
pnpm add @tomjs/unzip-crx
# yarn
yarn add @tomjs/unzip-crx
# npm
npm add @tomjs/unzip-crx
esm
import unzip from 'unzip-crx';
const crxFile = './this-chrome-extension.crx';
unzip(crxFile).then(() => {
console.log('Successfully unzipped your crx file..');
});
cjs
const unzip = require('unzip-crx');
const crxFile = './this-chrome-extension.crx';
unzip(crxFile).then(() => {
console.log('Successfully unzipped your crx file..');
});
- API Document provided by jsdocs.io.
- index.d.ts provided by unpkg.com.
file
: string, the path to the file to unzipdestination
: string, the path to the destination folder (optional)
Resolves with a Promise if the file was unzipped successfully, throws otherwise (use .catch()
).