File Upload in KoaJS

I'm trying to upload files using the code from example. But it's not working.

In the controller I wrote the code

var parse = require('co-busboy');
var fs = require('fs');
var path = require('path');

var parts = parse(this);
var part;

while (part = yield parts) {
    var stream = fs.createWriteStream('/tmp/' + part.filename);
    part.pipe(stream);
    console.log('uploading %s -> %s', part.filename, stream.path);
}

But when I upload images in the console I only get new uploading location. But on new location images are not saving.

Any Solution?

Thanks in Advance,

Nixon

I got the answer. I just had to remove '/' before the 'tmp'. So the code is like this

while (part = yield parts) {
var stream = fs.createWriteStream('tmp/' + part.filename);
part.pipe(stream);
console.log('uploading %s -> %s', part.filename, stream.path);
}