如果我在内存中以字符串的形式存储文件内容,而不将其写入磁盘,我将如何要求()一个文件?下面是一个例子:
// Load the file as a string
var strFileContents = fs.readFileSync( "./myUnalteredModule.js", 'utf8' );
// Do some stuff to the files contents
strFileContents[532] = '6';
// Load it as a node module (how would I do this?)
var loadedModule = require( doMagic(strFileContents) );