isolated-vm
isolated-vm copied to clipboard
Add more examples
Good afternoon!
Please, could you add at least one example to the README file?
Specifically, I would like to see how to make a two-way function between the main and isolated environments, where an instance of the class is fed to the isolated environment, and the same instance is returned to the main process, but with changed parameters.
Such a funny implementation is needed to be sure that the class fields have changed.
Thank you in advance for your answer!
I second this, having trouble finding any examples and the documentation, while it technically covers everything, is limited in how to piece it all together. I'm switching out from node:VM for security and just trying to figure out how to do it all the isolated-vm way.
Thanks!
Yes please. I have been stuck for a while trying to properly load modules in the IVMs, an example of that would be so great. Also maybe an explanation of why IVM doesn't implement it out of the box. Is it just not implemented or there is some underlying problem that I'm not aware of that prevents it entirely.
What kind of example(s) would you love to see?
For example, how to transfer complex nested objects in and out from an isolate
You would use ExternalCopy for that https://github.com/laverdet/isolated-vm#class-externalcopy-transferable
Thanks, @laverdet, I was guessing that, but can't figure out how exactly, especially to bring values out. Some examples would be very useful here.
You can also use copy:true https://github.com/laverdet/isolated-vm#transferoptions
Oh, totally missed that flag. This worked like a charm, thanks! Again, some (even trivial) examples could help people new to isolated-vm
a lot in my opinion!
I'm new to this library today (vm2 discontinued) and it is really hard to find just a trivial example. Some variables in, run code, get result out. Use some modules inside.