Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Dec 18, 2010
1 parent 40dbb98 commit d8d4226
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions README.md
@@ -1,4 +1,4 @@
Packnode encrypts node modules for private use
`packnode` encrypts node modules for private use

To install packnode, use [npm](http://github.com/isaacs/npm)

Expand All @@ -10,16 +10,6 @@ To pack a module using a password (e.g. `pass123`), run

$ cat myscript.js | packnode pass123 > packed.js

CoffeeScript modules can be packed using

$ cat myscript.coffee | coffee -c -s | packnode pass123 > packed.js

To specify a custom encryption algorithm or output encoding, use `-a` and `-e`

$ packnode -a aes256 -e hex < myscript.js > packed.js

## Using a packed module

Encrypted modules can be accessed by calling `unpack(password)`

require('./packed').unpack('pass123'); //Same as require('./myscript')
Expand Down Expand Up @@ -54,3 +44,13 @@ Running both modules

require('./hello1').world(); //Outputs 'Hello world!'
require('./hello2').unpack('pass123').world(); //Outputs 'Hello world!'

## Advanced

CoffeeScript modules can be packed using

$ cat myscript.coffee | coffee -c -s | packnode pass123 > packed.js

To specify a custom encryption algorithm or output encoding, use `-a` and `-e`

$ packnode -a aes256 -e hex < myscript.js > packed.js
2 changes: 1 addition & 1 deletion packnode
Expand Up @@ -68,7 +68,7 @@ stdin.on('end', function () {

// Prepare the output
packed = 'var crypto = require("crypto");\n'
packed += 'packed = "' + chunk.join('";\npacked += "') + '";\n';
packed += 'packed = "' + chunk.join('";\npacked += "') + '";\n';
packed += 'exports.unpack = function (password) {\n';
packed += ' var decipher = crypto.createDecipher("' + algorithm + '", password);\n';
packed += ' exports = (function (exports, packed) {\n';
Expand Down

0 comments on commit d8d4226

Please sign in to comment.