Skip to content

Instantly share code, notes, and snippets.

@cranic
Last active January 2, 2016 20:29
Show Gist options
  • Select an option

  • Save cranic/8356759 to your computer and use it in GitHub Desktop.

Select an option

Save cranic/8356759 to your computer and use it in GitHub Desktop.
var busboy = require('busboy');
var fs = require('fs');
app.post('/upload', function(req, res){
var upload = new busboy({headers: req.headers});
upload.on('file', function(field, file, filename){
var gravar = fs.createWriteStream('/alguma/pasta/' + filename);
gravar.on('end', function(){
res.send('Upload terminado!');
});
file.pipe(gravar);
});
req.pipe(upload);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment