I'm writing a cli that PUT
s data to a Meteor backend, which in turn uses express connect middleware. Any large file (over 700K) never finish uploading and the _req.on("end"
event never fires.
Smaller files (under 700K) work fine however, and the _req.on("end"
event always fires.
This is the cli client:
fs.readFile(file, function(err, data) {
var req = http.request({
method: 'PUT',
host: 'localhost',
path: '/api/deploy',
port: '3000',
timeout: 60 * 60 * 1000, // 1 hour
headers : {
"Content-Length" : data.length
}
},
function(response) {
console.log("done");
}
);
req.write(data);
req.end();
});
And here is the relevant server code:
this.route("deploy", {
where: "server"
, path: "/api/deploy"
, action: function() {
var _self = this;
var _req = _self.request;
var _total = _self.request.headers["content-length"];
var _write = fs.createWriteStream("/tmp/test.tar");
_req.pipe(_write);
var _consumed = 0;
_req.on("data", function(chunk) {
_consumed += chunk.length;
var uploadProgress = (_consumed/_total) * 100;
console.log(uploadProgress);
});
_req.on("end", function() {
console.log("ALL DONE");
});
}
});
I've tried adjusting the connect upload parameter in the bodyParser and elsewhere. If the default limit is 100mb, then I don't think this is the issue anyway.
Any help would be great. I am on OSX Mavericks. There is a hard limit set somewhere, I just don't know what it is, nor how to circumvent it.