{"id":13610432,"url":"https://github.com/thom4parisot/crx","last_synced_at":"2026-03-15T10:30:26.223Z","repository":{"id":40701555,"uuid":"2556548","full_name":"thom4parisot/crx","owner":"thom4parisot","description":"A node.js command line app for packing Google Chrome extensions.","archived":false,"fork":false,"pushed_at":"2023-04-14T18:44:28.000Z","size":906,"stargazers_count":516,"open_issues_count":23,"forks_count":70,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-29T14:39:01.309Z","etag":null,"topics":["chrome-extension","crx","crx-pack"],"latest_commit_sha":null,"homepage":"https://npmjs.com/crx","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thom4parisot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2011-10-11T16:28:30.000Z","updated_at":"2024-10-21T20:29:12.000Z","dependencies_parsed_at":"2024-01-14T07:04:16.089Z","dependency_job_id":"9699d6fb-8a20-4508-967b-83b0d1b6e2d1","html_url":"https://github.com/thom4parisot/crx","commit_stats":{"total_commits":186,"total_committers":30,"mean_commits":6.2,"dds":0.7849462365591398,"last_synced_commit":"23766455f8df72b3d13d3e72101fe632e052383c"},"previous_names":["oncletom/crx"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fcrx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fcrx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fcrx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thom4parisot%2Fcrx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thom4parisot","download_url":"https://codeload.github.com/thom4parisot/crx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208145,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome-extension","crx","crx-pack"],"created_at":"2024-08-01T19:01:44.661Z","updated_at":"2025-12-18T00:24:04.018Z","avatar_url":"https://github.com/thom4parisot.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# crx [![Build Status](https://secure.travis-ci.org/oncletom/crx.svg)](http://travis-ci.org/oncletom/crx) [![Build status](https://ci.appveyor.com/api/projects/status/i8v95qmgwwxic5wn?svg=true)](https://ci.appveyor.com/project/oncletom/crx)\n\n\u003e 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**!\n\nPackages are available to use `crx` with:\n\n- *grunt*: [grunt-crx](https://npmjs.com/grunt-crx)\n- *gulp*: [gulp-crx-pack](https://npmjs.com/gulp-crx-pack)\n- *webpack*: [crx-webpack-plugin](https://npmjs.com/crx-webpack-plugin)\n\nMassive hat tip to the [node-rsa project](https://npmjs.com/node-rsa) for the pure JavaScript encryption!\n\n**Compatibility**: this extension is compatible with `node\u003e=10`.\n\n## Install\n\n```bash\n$ npm install crx\n```\n\n## Module API\n\nAsynchronous functions returns a native ECMAScript Promise.\n\n```js\nconst fs = require('fs');\nconst path = require('path');\n\nconst ChromeExtension = require('crx');\n\nconst crx = new ChromeExtension({\n  codebase: 'http://localhost:8000/myExtension.crx',\n  privateKey: fs.readFileSync('./key.pem')\n});\n\ncrx.load( path.resolve(__dirname, './myExtension') )\n  .then(crx =\u003e crx.pack())\n  .then(crxBuffer =\u003e {\n    const updateXML = crx.generateUpdateXML()\n\n    fs.writeFileSync('../update.xml', updateXML);\n    fs.writeFileSync('../myExtension.crx', crxBuffer);\n  })\n  .catch(err=\u003e{\n    console.error( err );\n  });\n```\n\n### ChromeExtension = require(\"crx\")\n### crx = new ChromeExtension(attrs)\n\nThis module exports the `ChromeExtension` constructor directly, which can take an optional attribute object, which is used to extend the instance.\n\n### crx.load(path|files)\n\nPrepares the temporary workspace for the Chrome Extension located at `path` — which is expected to directly contain `manifest.json`.\n\n```js\ncrx.load('/path/to/extension').then(crx =\u003e {\n  // ...\n});\n```\n\nAlternatively, you can pass a list of files — the first `manifest.json` file to be found will be considered as the root of the application.\n\n```js\ncrx.load(['/my/extension/manifest.json', '/my/extension/background.json']).then(crx =\u003e {\n  // ...\n});\n```\n\n### crx.pack()\n\nPacks the Chrome Extension and resolves the promise with a Buffer containing the `.crx` file.\n\n```js\ncrx.load('/path/to/extension')\n  .then(crx =\u003e crx.pack())\n  .then(crxBuffer =\u003e {\n    fs.writeFileSync('/tmp/foobar.crx', crxBuffer);\n  });\n```\n\n### crx.generateUpdateXML()\n\nReturns a Buffer containing the update.xml file used for `autoupdate`, as specified for `update_url` in the manifest. In this case, the instance must have a property called `codebase`.\n\n```js\nconst crx = new ChromeExtension({ ..., codebase: 'https://autoupdateserver.com/myFirstExtension.crx' });\n\ncrx.load('/path/to/extension')\n  .then(crx =\u003e crx.pack())\n  .then(crxBuffer =\u003e {\n    // ...\n    const xmlBuffer = crx.generateUpdateXML();\n    fs.writeFileSync('/foo/bar/update.xml', xmlBuffer);\n  });\n```\n\n### crx.generateAppId\n\nGenerates application id (extension id) from given path.\n\n```js\nnew crx().generateAppId('/path/to/ext') // epgkjnfaepceeghkjflpimappmlalchn\n```\n\n## CLI API\n\n### crx pack [directory] [--crx-version number] [-o file] [--zip-output file] [-p private-key]\n\nPack the specified directory into a .crx package, and output it to stdout. If no directory is specified, the current working directory is used.\n\nUse the `--crx-version` option to specify which CRX format version to output. Can be either \"2\" or \"3\", defaults to \"3\".\n\nUse the `-o` option to write the signed extension to a file instead of stdout.\n\nUse the `--zip-output` option to write the unsigned extension to a file.\n\nUse the `-p` option to specify an external private key. If this is not used, `key.pem` is used from within the directory. If this option is not used and no `key.pem` file exists, one will be generated automatically.\n\nUse the `-b` option to specify the maximum buffer allowed to generate extension. By default, will rely on `node` internal setting (~200KB).\n\n### crx keygen [directory]\n\nGenerate a 2048-bit RSA private key within the directory. This is called automatically if a key is not specified, and `key.pem` does not exist.\n\nUse the `--force` option to overwrite an existing private key located in the same given folder.\n\n### crx --help\n\nShow information about using this utility, generated by [commander](https://github.com/visionmedia/commander.js).\n\n## CLI example\n\nGiven the following directory structure:\n\n```\n└─┬ myFirstExtension\n  ├── manifest.json\n  └── icon.png\n```\n\nrun this:\n\n```bash\n$ cd myFirstExtension\n$ crx pack -o\n```\n\nto generate this:\n\n```bash\n├─┬ myFirstExtension\n│ ├── manifest.json\n│ ├── icon.png\n│ └── key.pem\n└── myFirstExtension.crx\n```\n\nYou can also name the output file like this:\n\n```bash\n$ cd myFirstExtension\n$ crx pack -o myFirstExtension.crx\n```\n\nto get the same results, or also pipe to the file manually like this.\n\n```bash\n$ cd myFirstExtension\n$ crx pack \u003e ../myFirstExtension.crx\n```\n\nAs you can see a key is generated for you at `key.pem` if none exists. You can also specify an external key. So if you have this:\n\n```\n├─┬ myFirstExtension\n│ ├── manifest.json\n│ └── icon.png\n└── myPrivateKey.pem\n```\n\nyou can run this:\n\n```bash\n$ crx pack myFirstExtension -p myPrivateKey.pem -o\n```\n\nto sign your package without keeping the key in the directory.\n\n# License\n\n[MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthom4parisot%2Fcrx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthom4parisot%2Fcrx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthom4parisot%2Fcrx/lists"}