Uploading file to serverless
If I want to upload a file to serverless, then what is the way to do this? Somewhere I saw to use intermediate base64 representation. Setting aside the latency issues for encoding and decoding, what if my file is very large? I have to convert to base64 and then append a very large string to my request, which is not very neat. Also as the file grows larger, we would send large strings, is there any throughput loss compared to multidata-format upload?
3 Replies
Best option is to use S3 bucket if you do not want to use B64
Yeah serverless doesn't support multipart uploads, it only supports sending something in the request (base64) or downloading from a URL.
Yup, I use google firebase for file storage upload, and i get a URL from it, and i just pass it along.
depending what ur doing u can also do some optimizations on the file itself, for ex. i work with audio a lot for transcription, so i could set it to monochannel, reduce the bitrate, etc, to just see if preprocessing it works before going to a url option