Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #3 from oncletom/master

Added support for maxBuffer
  • Loading branch information...
commit e809a23c3eafbb335d886047874472eacee461f2 2 parents aab1ff6 + cfef609
Jed Schmidt authored

Showing 3 changed files with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. +2 0  README.md
  2. +6 2 bin/crx.js
  3. +1 1  src/crx.js
2  README.md
Source Rendered
@@ -76,6 +76,8 @@ Use the `-f` option to output to a file instead of stdout; if no file is specifi
76 76
77 77 Use 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.
78 78
  79 +Use the `-b` option to specify the maximum buffer allowed to generate extension. By default, will rely on `node` internal setting (~200KB).
  80 +
79 81 ### crx keygen [directory]
80 82
81 83 Generate a 1,024-bit RSA private key within the directory. This is called automatically if a key is not specified, and `key.pem` does not exist.
8 bin/crx.js
@@ -18,6 +18,7 @@ program
18 18 .version("0.2.8")
19 19 .option("-f, --file [file]", "input/output <file> instead of stdin/stdout")
20 20 .option("-p, --private-key <file>", "relative path to private key [key.pem]")
  21 + .option("-b, --max-buffer <total>", "max amount of memory allowed to generate the crx, in byte")
21 22 // coming soon
22 23 // .option("-x, --xml", "output autoupdate xml instead of extension ")
23 24
@@ -70,14 +71,17 @@ function pack(dir) {
70 71 ? resolve(cwd, program.privateKey)
71 72 : join(input, "key.pem")
72 73
73   - , crx = new ChromeExtension
  74 + , crx = new ChromeExtension({
  75 + rootDirectory: input,
  76 + maxBuffer: program.maxBuffer
  77 + })
74 78
75 79 fs.readFile(key, function(err, data) {
76 80 if (err) keygen(dir, pack.bind(null, dir))
77 81
78 82 crx.privateKey = data
79 83
80   - crx.load(input, function(err) {
  84 + crx.load(function(err) {
81 85 if (err) throw err
82 86
83 87 this.pack(function(err, data){
2  src/crx.js
@@ -102,7 +102,7 @@ module.exports = new function() {
102 102
103 103 this.loadContents = function(cb) {
104 104 var command = "zip -qr -9 -X - . -x key.pem"
105   - , options = {cwd: this.path, encoding: "binary"}
  105 + , options = {cwd: this.path, encoding: "binary", maxBuffer: this.maxBuffer}
106 106
107 107 exec(command, options, function(err, data) {
108 108 if (err) return cb.call(this, err)

0 comments on commit e809a23

Please sign in to comment.
Something went wrong with that request. Please try again.