Skip to content

curl: (55) Send failure: Broken pipe error #3312

Closed
@szbk

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions