Created
March 28, 2016 14:53
-
-
Save viebig/4252c4cfe0c70ae03c77 to your computer and use it in GitHub Desktop.
Restify stream
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
var assert = require('assert'); | |
var fs = require('fs'); | |
var restify = require('restify'); | |
var server = restify.createServer(); | |
server.put('/:name', function (req, res, next) { | |
var stream = fs.createWriteStream('/tmp/' + req.params.name); | |
req.pipe(stream); | |
req.once('end', function () { | |
console.log('srv: responding'); | |
res.send(204); | |
}); | |
next(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment