Last active
August 29, 2015 14:01
-
-
Save TimHeckel/b03f9ecc81ffa96ab303 to your computer and use it in GitHub Desktop.
Recommendations on how to pipe this?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Iron Router route: | |
this.route("poster", { | |
where: "server" | |
, path: "/post" | |
, action: function() { | |
var size = 0; | |
var future = new Future(); | |
var _dcb = future.resolver(); | |
var _data = Meteor._wrapAsync(function(data) { | |
size += data.length; | |
console.log('Got chunk2: ' + data.length + ' total: ' + size); | |
}); | |
this.request.on("data", _data); | |
this.request.on("end", function() { | |
console.log("ALL DONE"); | |
this.response.end("Thanks"); | |
}); | |
this.request.on("error", function(e) { | |
console.log("ERROR: " + e.message); | |
}); | |
} | |
}); | |
All of this has to be run within a Fiber for large files, otherwise the `end` event never fires | |
unless I comment out the `response.end()` in the iron router code: | |
https://github.com/EventedMind/iron-router/blob/dev/lib/server/route_controller.js#L44 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment