I have a PhantomJS/CasperJS script which I\'m running from within a node.js script using process.spawn(). Since CasperJS doesn\'t support require()
process.spawn()
require()
Old stuff but still useful...
I have made a custom stream Transform subclass for this purpose.
See https://stackoverflow.com/a/59400367/4861714