NodeJS, OpenCV and Streaming Images Using Net Socket

后端 未结 1 599
迷失自我
迷失自我 2021-02-04 20:08

My end goal is to stream video from my laptop to a server. I\'m trying to accomplish this by using NodeJs on the laptop & the server. I use the OpenCV library to capture the

相关标签:
1条回答
  • 2021-02-04 20:14

    I suspect you're seeing end event while the last bit of data is still buffered.

    Try waiting for the close event rather than the end event. I'm not sure about sockets, but in other Node APIs like spawn, the end event is fired early, before related streams are flushed, so there may still be buffered data waiting.

    You could avoid managing this yourself by piping. Use fs.createWriteStream() and .pipe() the socket stream to the file.

    0 讨论(0)
提交回复
热议问题