In the README, a warning is given about the use of MemoryStorage:
Uploading very large files, or relatively small files in large numbers very quickly, can cause your application to run out of memory when memory storage is used.
I was planning to use the memory storage feature to obtain a single file and then relay that file to remote storage (such as AWS S3) assuming it met some arbitrary conditions. All of these files will be under 2 MB and often less than 1 MB, and there might be a few thousand of these uploads per hour.
Is this a use case in which I should not use memory storage? If so, are there any workarounds that would permit me to continue using multer and still relay uploaded files to a remote location?
I think the problem is mostly that a malicious client could spam you with very large requests, and then never send the last packet which would make your server allocate large amounts of memory and keep it until the socket times out.
A few thousands 2 MB files an hour shouldn't be a problem at all. As soon as you are done with the request, the memory will be freed (or rather, when the GC decides to cleanup, but that's usually almost straight away).
Great (I appreciate the quick response). That's all I needed to know!
Most helpful comment
I think the problem is mostly that a malicious client could spam you with very large requests, and then never send the last packet which would make your server allocate large amounts of memory and keep it until the socket times out.
A few thousands 2 MB files an hour shouldn't be a problem at all. As soon as you are done with the request, the memory will be freed (or rather, when the GC decides to cleanup, but that's usually almost straight away).