In my browser side script, I want to get the entire POST request payload stream.
But when the body is a FormData object, especially when it contains a file blob, is there any easy way to make it?
The reason for doing this is that I want to make AES encrypt on the whole request body, using axios request interceptor.
For example:
I want to convert the FormData object:
const fd = new FormData()
fd.append('example.png', file) // here file is a file object from the file input object
Into the below content:
------WebKitFormBoundaryMV9GYQ2pcwRJ6XAA
Content-Disposition: form-data; name="image"; filename="example.png"
Content-Type: image/png
<<blob bytes>>
------WebKitFormBoundaryMV9GYQ2pcwRJ6XAA--
Is there any easy way to make it or any exists npm packages?