I am wondering if there is an async version of this block:
app.use(function (req, res, next) {
if (isJSRequiringCoverage(req)) {
var file = getFilePath(req), //translate request to file name to be delivered
code = readTheCodeFromFile(file), //use async for a real implementation
instrumenter = im.getInstrumenter();
res.send(instrumenter.instrumentSync(code, file));
//exception handling omitted for brevity
} else {
next();
}
});
something like this:
let instrumenter = im.getInstrumenter();
app.use(function (req, res, next) {
let file = getFilePath(req);
fs.createReadStream(file).pipe(instrumenter.instrument(file)).pipe(res);
});
if this is possible, something like this def belongs in the readme...however it would totally make sense if it were pretty much impossible to instrument code asynchronously/line-by-line.
Hey, this is looking good
I am wondering if there is an async version of this block:
something like this:
does something like this exist?