Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async version of instrumentSync() #46

Open
ORESoftware opened this issue May 31, 2017 · 1 comment
Open

Async version of instrumentSync() #46

ORESoftware opened this issue May 31, 2017 · 1 comment

Comments

@ORESoftware
Copy link

ORESoftware commented May 31, 2017

Hey, this is looking good

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);
});

does something like this exist?

@ORESoftware
Copy link
Author

ORESoftware commented Jun 1, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant