Reputation: 6358
so I have a post route and the payload is a json.
It has a number of fields and one is a base64 encoded string corresponding to a large png file.
the error I get is
PayloadTooLargeError: request entity too large
at readStream (/Users/reza.razavipour/Projects/s3uploader/node_modules/raw-body/index.js:155:17)
at getRawBody (/Users/reza.razavipour/Projects/s3uploader/node_modules/raw-body/index.js:108:12)
at read (/Users/reza.razavipour/Projects/s3uploader/node_modules/body-parser/lib/read.js:77:3)
how do I get around this limitation?
In the future I will have to process very large many Gbs zip files...
Upvotes: 2
Views: 988
Reputation: 1982
According to documentation there is a limit
option one can pass to the json parser in order to configure the body limit.
limit
Controls the maximum request body size. If this is a number, then the value specifies the number of bytes; if it is a string, the value is passed to the bytes library for parsing. Defaults to '100kb'.
Something like this for 100 megabytes:
bodyParser.json({ limit: '100mb' })
Upvotes: 5