I'm struggling to work out how to take the output of a spawned child process and feed that output into a multipart mime upload.
Here is what I have that as far as I can tell should work
var request = require('superagent');
var spawn = require('child_process').spawn;
var spawned = spawn('echo', ['hello', 'world']);
request.post('http://localhost/api/upload')
.attach('file', spawned.stdout)
.end(function(res) {
console.log("DONE", res);
});
Unfortunately this throws the rather unhelpful Error: socket hang up
response from Node.