Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: uploads file the s3 api. #774

Open
borissmidt opened this issue Dec 3, 2021 · 1 comment
Open

Feature: uploads file the s3 api. #774

borissmidt opened this issue Dec 3, 2021 · 1 comment

Comments

@borissmidt
Copy link
Contributor

I've had a look at how to upload a file with the S3 client and it seems the minimum chunk-size is 5MB.
It might be useful for the user to have a utility method to automatically select the right upload type.
It however will need to have an added dependency to https://github.com/monix/monix-nio.

  def upload(key: String, file: Path) = {
    if (Files.size(file) < awsMinChunkSize) {
      s3.upload(bucket, key, Files.readAllBytes(file))
    } else {
      monix.nio.file
        .readAsync(file, awsMinChunkSize)(global)
        .consumeWith(s3.uploadMultipart(bucket, key))
    }
  }
@paualarco
Copy link
Member

Sounds like a useful method to implement!

We already have implemented something similar to upload objects from files to the google cloud storage , which does not depends on monix-nio, so probably we could do it like that too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants