Currently I'm working on an azure function written in typescript.
The function should be able to handle a form-data received through a POST request. In this request, files and text will be send. How can I work with both?
Right now, I'm using the parse-multipart library, but it only seems to work with the files. Every time I send a file field and a text field, it returns an error.
I also tried using the formidable library, with no success. It expects the request object to have a on method, which the HttpRequest from Azure does not.
The request instance has a method called formData which gets me the both values. However, the file data looks like: { size: 3115398, type: 'image/jpeg', name: 'imageName.jpg', lastModified: 1706633173379 } (no buffer), so I can't work with it.
Any solutions?
Thanks to @anzharip.
This code worked for me. In code we are using
@anzp/azure-function-multipartmodule.My code
HttpTrigger1/index.ts:hello.txt:OUTPUT: