node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org ยป


packnode minifies, obfuscates and/or encrypts node modules for private use.

To install packnode, use npm

$ npm install pack

Packing a module

To compress and obfuscate myscript.js using uglifyjs, run

$ cat myscript.js | packnode > packed.js

To encrypt myscript.js using the password pass123, run

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

Encrypted modules can be accessed by calling



The following example was packed using

$ packnode pass123 < hello1.js > hello2.js

hello1.js = function () {
    console.log('Hello world!');


exports.unpack=function(p){var d=require("crypto").createDecipher("aes256",p);eval(d.update(e,"hex","utf8")"utf8"));return exports}

Both are equivalent

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

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


CoffeeScript modules can be packed using

$ cat | 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 has built-in support for unpacking encrypted modules.

To run an encrypted job, use the -u switch to specify the password

$ -u pass123 myjob