Is there a standard way of getting content type from a command output?

I have a simple server in node.js that runs external commands. Theses commands already provide the correct Content-type header:

exec(filename, {env: process.env}, function (error, stdout, stderr) {
    res.write(stdout);
    res.end();
});

If I do that, node will set Content-type to 'text/plain'. I could parse stdout to get the Content-type but I wonder if there is another way of doing this. Thanks!