I have written a bunch of code that's deployed as a Firebase function. Some of it could be replaced with a simple call to an executable CLI. i.e., cat x | xargs ...
But a lot of that function's code would still need to exist to process the result. Is there a way to make a Firebase function execute something on the CLI, like this:
const { exec } = require("child_process");
exec("ls -la", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
My function code is in nodejs.