Monday, 24 April 2017

Koa2 Server Return binary data

I have a litte Koa2 Application running in node v7.7.3

My koa-router handler function for /capture is called correctly and my webcam takes a shot. But for some reason I am not able to return the resulting Buffer in cmd.stdout ... and yes the Buffer is filled.

router.get(['/capture'], function (ctx, next) {
    const cmd = spawn('fswebcam', ['-r800x600', '-S1', '--jpeg', '100', '--device', '/dev/video1', '--timestamp', '%d-%m-%Y %H:%M:%S (%Z)', '-']);
    console.log(cmd.status);
    console.log(cmd.stdout);
    this.body = cmd.stdout;
    return cmd.stdout;
});



via Pascal

No comments:

Post a Comment