Node message with a big error (1.3 mb): 413 Request Entity Too Large

with fiddler Im creating a header message

application content type / text-rich

app.post('/books',function(req,res){
        var writeStream  = fs.createWriteStream('C://Books.txt' ,{ flags : 'w' });
        writeStream.write(req.body)

I managed to stop debugging in var writestream, but when I cleaned this line I got an error Entity is too large

Is there any technique to overcome this problem? I just wanted to send a large text file ...

after reading some posts, I added the following which does not help ...

var bodyParser = require('body-parser');

    app.use( bodyParser.json({limit: '2mb'}) );       
    app.use(bodyParser.urlencoded({     
        extended: true,
        keepExtensions: true,
        limit: '2mb', 
        defer: true 
    }));

UPDATE

I also tried the following

  app.use(bodyParser.raw({ type: 'application/text-enriched' }));
    app.use( bodyParser.raw({limit: '10mb'}) );
    app.use(bodyParser.urlencoded({     
        extended: true,
        keepExtensions: true,
        limit: '10mb', 
        defer: true
    }));

also got the same error ... 413 Request Entity Too Large

+4
source share
1 answer

body-parser, . -

app.use( bodyParser.raw({limit: '1mb'}) );   

app.use( bodyParser.text({
    type : 'application/text-enriched', 
    limit: '1mb'
}) );   
+3

All Articles