Skip to content

Latest commit

 

History

History
66 lines (41 loc) · 2.27 KB

README.md

File metadata and controls

66 lines (41 loc) · 2.27 KB

@tomjs/unzip-crx

npm node-current (scoped) NPM jsDocs.io

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

# pnpm
pnpm add @tomjs/unzip-crx

# yarn
yarn add @tomjs/unzip-crx

# npm
npm add @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()).