Node.js JXcore package
Node.js is an open source, cross-platform runtime environment for server and networking applications.
JXcore is a multi-threaded Node.js release, you basically do not need to make any changes to existing code can be run directly in a thread-safe multi-threaded.
But we This article is going to teach you about JXcore packaging function.
JXcore installation
Download JXcore installation package, and extract in the extracted directory provides jx binary command, then we mainly use this command.
Step 1, Download
Download JXcore installation package https://github.com/jxcore/jxcore-release , you need according to your own system environment to download the installation package.1, Window platform download: the Download (the Windows x64-(V8)) .
2, Linux / OSX install command:
$ curl http://jxcore.com/xil.sh | bash
If you have permission, you can use the following command:
curl http://jxcore.com/xil.sh | sudo bash
If the above steps correctly, use the following command will output the version number information:
$ jx --version v0.10.32
Package code
For example, our Node.js project contains the following documents, which index.js master file:
drwxr-xr-x 2 root root 4096 Nov 13 12:42 images -rwxr-xr-x 1 root root 30457 Mar 6 12:19 index.htm -rwxr-xr-x 1 root root 30452 Mar 1 12:54 index.js drwxr-xr-x 23 root root 4096 Jan 15 03:48 node_modules drwxr-xr-x 2 root root 4096 Mar 21 06:10 scripts drwxr-xr-x 2 root root 4096 Feb 15 11:56 style
Next, we use the commandjx package above items, for the master file and specify index.js Node.js project:
$ jx package index.js index
The above command is executed successfully generates the following two files:
index.jxp This is a middleware file that contains a complete project information need to be compiled.
index.jx This is a complete package of information binaries can be run on the client.
Loading JX file
We use thejx command packaged items:
$ node index.js command_line_arguments
After using JXcore compiled, we can use the following command to perform binary file generated jx:
$ jx index.jx command_line_arguments
More JXcore features you can refer to the official website: http://jxcore.com/ .