#Stream multipart file to S3 storage

1 messages · Page 1 of 1 (latest)

tired granite
#

Hi !
I'm currently trying to setup a webapp allowing to upload and store files in a S3 storage (MinIO).
But all the examples i found on Internet only talk about uploading to a temporary file and then transfert the tempfile to S3.
Is there any way (and maybe examples) to upload files directly through a stream ?

i'm using rust-s3-async to manage my s3 server, and there are 2 ways to upload files:

  • using a reader (std::io::Read + Unpin)
  • using chunks (Vec<u8>)

I already tried some stuff but i only get errors like Multipart error: not consumed

sullen flicker
#

Why not use signedurls?

tired granite
#

hmmm, i can try that 🤔
i hope S3 will manage to follow if i request a lot of signedurls at the same time

sullen flicker
#

Yeah, thats the common approach unless you are doing some processing to it
You sign it yourself (with your s3 creds), so the only impact on s3 is checking sig when its used (along with upload)

#

As in its signed on your server, not requesting from them, so it doesn't slow down your request

tired granite
#

and how am i supposed to do if i want to link the files to my database ?

#

like: object 1 (in postgres) has files 1, 2 and 3 stored in S3 ? 🤔

sullen flicker
#

Yeah

#

As fields in the table