@aws-sdk/lib-storage #4603
Unanswered
ppolcik-fcis
asked this question in
Q&A
Replies: 2 comments
-
Did you ever find out the solution or reasoning to this? import { CompleteMultipartUploadCommandOutput, S3 } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
...
const upload = new Upload({
client: s3Client,
params: s3Params,
});
const output = await upload.done() as CompleteMultipartUploadCommandOutput; |
Beta Was this translation helpful? Give feedback.
0 replies
-
there is a more elegant solution: import { CompleteMultipartUploadCommandOutput, S3 } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
...
const upload = new Upload({
client: s3Client,
params: s3Params,
});
const data = await upload.done();
if (!("Location" in data)) {
throw Error("Abort file upload");
}
// data is now typeof CompleteMultipartUploadCommandOutput |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is the return type of
done
function in@aws-sdk/lib-storage
correct?The function signature states that the return type is
Promise<AbortMultipartUploadCommandOutput | CompleteMultipartUploadCommandOutput>
, but from what I can see, the__abortTimeout
never resolves the promises only rejects it.If I understand correctly, if the upload is aborted, then an error will be thrown and the
AbortMultipartUploadCommandOutput
will not be aborted.Hence, I think the return type of the
done
function should be simply thePromise<CompleteMultipartUploadCommandOutput>
.If not, then the second part of my question is - what's the recommended way to find out, what was actually the return type after the upload has finished?
best,
Piotr
Beta Was this translation helpful? Give feedback.
All reactions