Capturing stdout/stderr of Node-API module running in Electron

I’m developing a Node-API module together with an Electron application. The N-API module is running in the render process of Electron, since it has a pretty complex API, that would be hard to get through a context bridge, and I’m only planning on running local resources anyway. However, none of the printing to stdout done by the N-API module is visible anywhere.

I’ve tried listening to the process.stdout, which fails because “The _read() method is not implemented”:

process.stdout.on("data", (data) => console.log(data));

Piping also doesn’t work, because “Cannot pipe, not readable”:

const duplexStream = new Stream.Duplex();
duplexStream.on("data", (data) => console.log(data));
process.stdout.pipe(duplexStream);

I even tried overriding the stdout.write() method, which actually worked for calls from within JavaScript, but still didn’t show anything from the native module:

process.stdout.write = (data) => {
    console.log(data);
    return true;
};

So is there any way to view the stdout/stderr of a Node-API module from within the script?