javascript – Communication between C\C++ ADDON and NodeJS

Question:

I'm trying to implement a server capable of doing speech recognition. But this last part has to be implemented through a C\C++ Addon. Right now, I'm saving the wav file on the server and passing the name to the addon:

var obj1 = julius("nomeficheiro.wav","lista|palavras|possiveis");
word = obj1.recog;//resultado
cm = obj1.cm;//confiança no resultado

However my intention is: not write files to disk and do everything through memory. The speech recognizer accepts stdin as possible input. Is it possible to pipe between the C\C++ addon and the NodeJs?

Answer:

Yes, it is possible. Node.js has an infrastructure for running processes. This infrastructure is gathered in the Child Process module.

In node.js you can perform the piping procedure with a child process by supplying a readable stream as stdin. For more documentation, visit the subprocess.stdin section of the official documentation.

Scroll to Top
AllEscort