0
我想基本上是管两个命令行命令组合在一起,但我清楚地失去了一些东西:不知道为什么Node.js的管挂
var child = require('child_process');
var image_bin = child.spawn('cat', ['./t.jpg']);
var image_txt = child.spawn('openssl', ['base64']);
image_txt.on('pipe', function(src) {
console.error('something is piping into the writer');
});
image_bin.stdout.pipe(image_txt.stdout);
任何想法?
您将'stdout'重定向到'stdout'?它不会工作:) –
谢谢@IvanGrynko,那是我尝试的最后一件事。 image_bin.stdout.pipe(image_txt.stdin);还挂着,是你在想什么会工作? – socketwiz
你想只是base64编码图像? – dylants