Check if S3 file exists without throwing exceptions #2584
Labels
feature-request
A feature should be added or improved.
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
s3
Describe the feature
Currently in .NET Core SDK the only way to check if file exists in S3 is to send
GetObjectMetadataAsync
request (sendsHEAD
) and then catch exception if the file does not exist. BecauseS3FileInfo
was removed in the Core-version of SDK.But exceptions add huge overhead and AWS exceptions in particular add even more useless code. I profiled my app, and almost 3% of my app's CPU time are wasted on AWS exception creation, throwing and handling. Just to check if a file exist.
Use Case
Fast way to check if file exists before uploading.
Proposed Solution
Provide an exception-less way to check for 404 and "key not found" responses, via return codes for example.
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.S3 3.7.103.45
Targeted .NET Platform
.NET 6
Operating System and version
Windows Server 2016, Ubuntu 22
The text was updated successfully, but these errors were encountered: