'How Expressjs read request StreamData from c#

i cant transfer c# code to expressjs. I need help. How can i handle stream request in expressjs? The c# code is:

[OperationContract]
     [WebInvoke(UriTemplate="sale?id={id}&password={password}", 
     Method = "POST",
     RequestFormat = WebMessageFormat.Json,
     ResponseFormat = WebMessageFormat.Json)]
      string sale(string id, string password, Stream strPost)
      {
         string salesinfo = new StreamReader(strPost, System.Text.Encoding.GetEncoding("windows-1254")).ReadToEnd();
                       
        //todo code here
      }

I cant find whats equals to StreamReader in expressjs.

My code is this:

app.post("/sale", async (req, res) => {
  console.log('---start');

  req.on('data', function(data) {
    console.log(data);
  });

  req.on('end', function() {
    console.log('---end');
  });
  res.send();
});

I find success code:

app.post("/sale",bodyParser.raw({type: function(){return true;}, limit: '5mb'}),async (req, res) => {
  const obj = JSON.parse(Buffer.from(req.body).toString())
  res.json(obj);
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source