-
Notifications
You must be signed in to change notification settings - Fork 2k
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
@uppy/aws-s3-multipart: add shouldUseMultipart
option
#4205
Conversation
If we want to migrate all users of
|
2b5d9a4
to
f7c54db
Compare
shouldUseMultipart
option
@@ -43,6 +43,7 @@ export interface AwsS3MultipartOptions extends PluginOptions { | |||
opts: { uploadId: string; key: string; parts: AwsS3Part[]; signal: AbortSignal } | |||
) => MaybePromise<{ location?: string }> | |||
limit?: number | |||
shouldUseMultipart?: boolean | ((file: UppyFile, fileSize: number) => boolean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is fileSize
the second argument? Doesn't it already live in file
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's provided as a convenience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's cleaner to just have file
. It's not some deep object, it's simply file.size
. We can add another argument in the future when people start using it more and need more things or conveniences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that if UppyFile always has a .size
, then it's unnecessary/confusing/redundant to have a separate argument for it as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
i think it can be considered a breaking change, because i'm changing the signature of uploadPartBytes, which is an option. however I don't see uploadPartBytes documented in our docs, so maybe we can get away with a non major: - onProgress now gets passed number of bytes instead of `ev` - a new `size` argument (previously size was on body)
(inside multipart)
…sers can use file.size
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/aws-s3 | 3.1.1 | @uppy/status-bar | 3.1.2 | | @uppy/aws-s3-multipart | 3.3.0 | @uppy/transloadit | 3.1.4 | | @uppy/locales | 3.2.1 | uppy | 3.9.0 | - @uppy/aws-s3-multipart: allowedMetaFields: null means “include all” (Artur Paikin / #4437) - @uppy/aws-s3-multipart: add `shouldUseMultipart ` option (Antoine du Hamel / #4205) - @uppy/transloadit: Reset `tus` key in the file on error, so retried files are re-uploaded (Artur Paikin / #4421) - meta: commit build file that was modified (Antoine du Hamel) - meta: examples: add CORS settings for DigitalOcean Spaces (Antoine du Hamel / #4428) - @uppy/aws-s3: deprecate `timeout` option (Antoine du Hamel / #4298) - @uppy/aws-s3-multipart: make retries more robust (Antoine du Hamel / #4424) - meta: fix badges on README (Antoine du Hamel / #4419)
@@ -206,6 +265,9 @@ class HTTPCommunicationQueue { | |||
|
|||
async resumeUploadFile (file, chunks, signal) { | |||
throwIfAborted(signal) | |||
if (chunks.length === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be checking shouldUseMultipart like we do for uploadFile?
When uploading small files (e.g. ≤100MiB), using multipart can decrease the upload performance as it introduces more overhead for uploading just one part.
This can be solved without too much difficulty by hitting the non-multipart endpoint for files with only one chunk.