Need help with crx?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

426 Stars 69 Forks MIT License 230 Commits 21 Opened issues


A node.js command line app for packing Google Chrome extensions.

Services available


Need anything else?

Contributors list

crx Build Status Build status

crx is a utility to package Google Chrome extensions via a Node API and the command line. It is written purely in JavaScript and does not require OpenSSL!

Packages are available to use


Massive hat tip to the node-rsa project for the pure JavaScript encryption!

Compatibility: this extension is compatible with



$ npm install crx

Module API

Asynchronous functions returns a native ECMAScript Promise.

const fs = require('fs');
const path = require('path');

const ChromeExtension = require('crx');

const crx = new ChromeExtension({ codebase: 'http://localhost:8000/myExtension.crx', privateKey: fs.readFileSync('./key.pem') });

crx.load( path.resolve(__dirname, './myExtension') ) .then(crx => crx.pack()) .then(crxBuffer => { const updateXML = crx.generateUpdateXML()

fs.writeFile('../update.xml', updateXML);
fs.writeFile('../myExtension.crx', crxBuffer);

}) .catch(err=>{ console.error( err ); });

ChromeExtension = require("crx")

crx = new ChromeExtension(attrs)

This module exports the

constructor directly, which can take an optional attribute object, which is used to extend the instance.


Prepares the temporary workspace for the Chrome Extension located at

— which is expected to directly contain
crx.load('/path/to/extension').then(crx => {
  // ...

Alternatively, you can pass a list of files — the first

file to be found will be considered as the root of the application.
crx.load(['/my/extension/manifest.json', '/my/extension/background.json']).then(crx => {
  // ...


Packs the Chrome Extension and resolves the promise with a Buffer containing the

  .then(crx => crx.pack())
  .then(crxBuffer => {
    fs.writeFile('/tmp/foobar.crx', crxBuffer);


Returns a Buffer containing the update.xml file used for

, as specified for
in the manifest. In this case, the instance must have a property called
const crx = new ChromeExtension({ ..., codebase: '' });

crx.load('/path/to/extension') .then(crx => crx.pack()) .then(crxBuffer => { // ... const xmlBuffer = crx.generateUpdateXML(); fs.writeFile('/foo/bar/update.xml', xmlBuffer); });


Generates application id (extension id) from given path.

new crx().generateAppId('/path/to/ext') // epgkjnfaepceeghkjflpimappmlalchn


crx pack [directory] [--crx-version number] [-o file] [--zip-output file] [-p private-key]

Pack the specified directory into a .crx package, and output it to stdout. If no directory is specified, the current working directory is used.

Use the

option to specify which CRX format version to output. Can be either "2" or "3", defaults to "3".

Use the

option to write the signed extension to a file instead of stdout.

Use the

option to write the unsigned extension to a file.

Use the

option to specify an external private key. If this is not used,
is used from within the directory. If this option is not used and no
file exists, one will be generated automatically.

Use the

option to specify the maximum buffer allowed to generate extension. By default, will rely on
internal setting (~200KB).

crx keygen [directory]

Generate a 2048-bit RSA private key within the directory. This is called automatically if a key is not specified, and

does not exist.

Use the

option to overwrite an existing private key located in the same given folder.

crx --help

Show information about using this utility, generated by commander.

CLI example

Given the following directory structure:

└─┬ myFirstExtension
  ├── manifest.json
  └── icon.png

run this:

$ cd myFirstExtension
$ crx pack -o

to generate this:

├─┬ myFirstExtension
│ ├── manifest.json
│ ├── icon.png
│ └── key.pem
└── myFirstExtension.crx

You can also name the output file like this:

$ cd myFirstExtension
$ crx pack -o myFirstExtension.crx

to get the same results, or also pipe to the file manually like this.

$ cd myFirstExtension
$ crx pack > ../myFirstExtension.crx

As you can see a key is generated for you at

if none exists. You can also specify an external key. So if you have this:
├─┬ myFirstExtension
│ ├── manifest.json
│ └── icon.png
└── myPrivateKey.pem

you can run this:

$ crx pack myFirstExtension -p myPrivateKey.pem -o

to sign your package without keeping the key in the directory.


MIT License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.