Open kalyanjanaki opened 6 years ago
hey @kalyanjanaki , I think I hit the same issue. At long last I figured this out.
When the Request Body is Base64 encoded (by API Gateway, for example), the decoding you're doing is right, but when you turn the Buffer into a String you need to use binary
encoding for the String instead of the default utf8
:
const buf = Buffer.from(event['body'], 'base64').toString('binary);
@myshenin I think you should add this to the documentation.
Hello
Am trying to POST the gzip form-data. After the library parses the data, Am not able to convert the buffer to string.
Below is the code am using for testing.
`const multipart = require('aws-lambda-multipart-parser'); var zlib = require('zlib');
exports.handler = function(event,context,callback){ console.log(event);
}`
below is output of parser
and below is error when i try to unzip the buffer in above content. It is failing at the below line.
var stringBuf = zlib.gunzipSync(buf);