encryptModule
Syntax
encryptModule(name, [moduleDir], [overwrite=false])
Details
Encrypts a module (DOS file) to generate a distributable encrypted module (DOM file). This function can only be executed after login.
- The
saveModulefunction can also generate a DOM file, but it does not support encryption. encryptModuleincludes a function serialization protocol, so compatibility must be taken into account.- Encrypted modules generated on a 3.00.0-series server cannot run on any 2.00.0-series server.
- Encrypted modules generated on a 2.00.0-series server can run on a same-level 3.00.0-series server. For example, versions 2.00.17 and 3.00.4 are considered the same level, so an encrypted module generated on 2.00.17 can run on 3.00.4. However, compatibility is not guaranteed on 3.00.0-series servers with versions earlier than 3.00.4.
Parameters
name: A string specifying the name of the module file.
moduleDir: A string specifying the directory where the module file is located, which defaults to the [home]/modules directory of the node. The home directory can be queried using getHomeDir.
overwrite: A boolean value specifying whether to overwrite an existing DOM file with the same name. The default value is false, meaning the file will not be overwritten.
Returns
None.
Examples
Assume the modules directory under the node’s home directory contains the ta.dos module file. The following function serializes it into an encrypted binary file:
encryptModule("ta")
After successful execution, a file named ta.dom will appear in the modules directory.
Related functions
