Closed
Description
Hi.
My app.js
var http = require('http');
var fs = require('fs');
http.createServer(function(req, res){
var newFile = fs.createWriteStream('new_file.mkv');
var method = req.method;
var newSize = 0;
if(method == 'PUT'){
req.pipe(newFile);
req.on('data', function(chunk){
newSize += chunk.length;
console.log(newSize);
});
}
}).listen(8000, function(){
console.log('Listening..');
});
console command:
curl --upload-file read.mkv http://127.0.0.1:8000
Result:
curl: (55) Send failure: Broken pipe
What am I doing wrong?
Activity