Skip to content

Instantly share code, notes, and snippets.

@viebig
Created March 28, 2016 14:53
Show Gist options
  • Save viebig/4252c4cfe0c70ae03c77 to your computer and use it in GitHub Desktop.
Save viebig/4252c4cfe0c70ae03c77 to your computer and use it in GitHub Desktop.
Restify stream
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