I am confused about the use cases of the VM module in NodeJS.
After reading a little bit in the documentations about this module is just looks like a fancy way to do eval.
Anyone used it and lived to tell the tail about it use cases?
I am confused about the use cases of the VM module in NodeJS.
After reading a little bit in the documentations about this module is just looks like a fancy way to do eval.
Anyone used it and lived to tell the tail about it use cases?
The main purpose of this module is running JS in sanboxed context environment. For example when you need to execute the unverified JS code without the risk of affecting your node program execution. Moreover, you can specify execution timeout and context-specific error handling.
Example: interpreting the JS snippet created by user (interactive tutorials, etc).