I'm working on a nodejs app that works as a middleware for ZoneMinder. In short, my goal is to mask all ZoneMinder api so that the client doesn't know if I'm using ZM or not.
Everything work fine, but there is one thing that bugs me. There is a streaming api in ZM that gives a streaming JPEG (MJPEG) and you can put that in an img
tag. Right now I'm using pipe()
to pipe this stream to the client. Something like this:
app.get('/stream', async (req, res) => {
let url = 'do stuff here to get ZM url'
request(url).pipe(res);
})
This works. What I'm curious about is how exactly this pipe()
going to affect performance on my machine. Note that I'm running both ZM and the nodejs app on the same machine. Will the pipe()
make my system effectively bear double the load of the stream? Is there a better solution than this, given the desired outcome?