Typecasting CJS "module"

How would you typecast the requireFromString function in this StackOverflow answer?
https://stackoverflow.com/questions/17581830
Stack Overflow
How would I require() a file if I had the file's contents as a string in memory, without writing it out to disk? Here's an example:

// Load the file as a string
var strFileContents = fs.readFileSy...
Load node.js module from string in memory
Was this page helpful?