Skip to content

Instantly share code, notes, and snippets.

@bmeck
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmeck/9358766 to your computer and use it in GitHub Desktop.
Save bmeck/9358766 to your computer and use it in GitHub Desktop.
Can't say how long I wanted to do this
#
# Still a lot to do, but it works!
# Been looking at how to do this for a long time
#
# Todo: good quality ecryption
# Todo: in memory resources (right now it is self extracting)
# Todo: check windows, should work but probably needs some tweaking
#
# Many thanks to node-webkit for examples and zlib for including minizip
#
# --extracting sets up node to check if it is a self-extracting zip archive
./configure --extracting
make
# path to a module, main field in package.json will be executed on start
zip -r bundle.zip $PATH_TO_MODULE
cat node bundle.zip > bundled_node
chmod +x bundle_node
# run our bundled app
# respects the $TMPDIR convention
TMPDIR=$WHERE_TO_EXTRACT ./bundled_node
@bmeck
Copy link
Author

bmeck commented Mar 5, 2014

  • NODE_CHANNEL_FD existing will prevent re-extraction
  • spawn(process.execPath) is going to cause re-extraction, use fork or set NODE_CHANNEL_FD instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment