Skip to content

tomjs/unzip-crx

Repository files navigation

@tomjs/unzip-crx

npm node-current (scoped) NPM Docs

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!

Install

With pnpm

pnpm add @tomjs/unzip-crx

With yarn

yarn add @tomjs/unzip-crx

With npm

npm i @tomjs/unzip-crx

Example

  • 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..');
});

Documentation

API

unzip(file[, destination])

  • file: string, the path to the file to unzip
  • destination: string, the path to the destination folder (optional)

Resolves with a Promise if the file was unzipped successfully, throws otherwise (use .catch()).