How to read an image from phantomjs stdout in nodejs to serve it?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There's probably some detail that I'm missing, because the rasterization script works fine standalone, but I haven't been successful reading its output from NodeJS so far. Here's the NodeJS part: var http = require('http'); var qs = require('querystring'); var fs = require('fs'); var spawn = require('child_process').spawn; var SCRIPT = fs.readFileSync('./script.js', { encoding: 'utf8' }); http.createServer(function (request, response) { var body = ''; request.on('data', function (data) { body += data; }); request.on('end', function () { var