Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 58 lines (31 sloc) 1.684 kB
60ed3ac @chriso Slight minification, added -v and version bump
authored
1 **packnode minifies, obfuscates and/or encrypts node modules for private use.**
dd5493b @chriso First commit
authored
2
3 To install packnode, use [npm](http://github.com/isaacs/npm)
4
5 $ npm install pack
6
7 ## Packing a module
8
5e8b029 @chriso Use uglifyjs instead of the YUI compressor
authored
9 To compress and obfuscate `myscript.js` using [uglifyjs](https://github.com/mishoo/UglifyJS), run
f56172a @chriso Updated to use the YUI compressor instead of JSMin
authored
10
11 $ cat myscript.js | packnode > packed.js
12
13 To encrypt `myscript.js` using the password `pass123`, run
dd5493b @chriso First commit
authored
14
15 $ cat myscript.js | packnode pass123 > packed.js
16
33bb15d @chriso MInor fixes
authored
17 Encrypted modules can be accessed by calling
18
c786047 @chriso 0.2.3 release
authored
19 require(packed_file).unpack(password);
4928412 @chriso Updated readme & fixed small bug
authored
20
21 ## Example
22
23 The following example was packed using
24
25 $ packnode pass123 < hello1.js > hello2.js
26
c786047 @chriso 0.2.3 release
authored
27 *hello1.js*
4928412 @chriso Updated readme & fixed small bug
authored
28
29 exports.world = function () {
30 console.log('Hello world!');
31 };
32
c786047 @chriso 0.2.3 release
authored
33 *hello2.js*
4928412 @chriso Updated readme & fixed small bug
authored
34
c786047 @chriso 0.2.3 release
authored
35 e="5b3be6d94448754b6d8484a78b5f30d7a2c2598105d0e225166a0132bef8b1cba74422cb32a08289d092e331652e403f4c3239716c3fd1d4605156d9ebb8781e";
36 exports.unpack=function(p){var d=require("crypto").createDecipher("aes256",p);eval(d.update(e,"hex","utf8")+d.final("utf8"));return exports}
4928412 @chriso Updated readme & fixed small bug
authored
37
cb80043 @chriso Minor formatting
authored
38 Both are equivalent
4928412 @chriso Updated readme & fixed small bug
authored
39
40 require('./hello1').world(); //Outputs 'Hello world!'
c786047 @chriso 0.2.3 release
authored
41
4928412 @chriso Updated readme & fixed small bug
authored
42 require('./hello2').unpack('pass123').world(); //Outputs 'Hello world!'
d8d4226 @chriso Updated README
authored
43
44 ## Advanced
45
46 CoffeeScript modules can be packed using
47
48 $ cat myscript.coffee | coffee -c -s | packnode pass123 > packed.js
49
50 To specify a custom encryption algorithm or output encoding, use `-a` and `-e`
51
e552085 @chriso Updated README
authored
52 $ packnode -a aes256 -e hex < myscript.js > packed.js
53
55643ca @chriso Minor fix
authored
54 [node.io](http://node.io) has built-in support for unpacking encrypted modules.
e552085 @chriso Updated README
authored
55
33bb15d @chriso MInor fixes
authored
56 To run an encrypted job, use the `-u` switch to specify the password
e552085 @chriso Updated README
authored
57
58 $ node.io -u pass123 myjob
Something went wrong with that request. Please try again.