简体   繁体   中英

NodeJS vm 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM