You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After perusing the source code I'm wondering if there is an easier way to check if a file exists? Obviously, I could try to fetch the file and see if anything returns but this is an expensive operation. It would be nice if there was a function to wrap a basic HEAD request to check for the existence of a file.
The text was updated successfully, but these errors were encountered:
Hi @bpmason1, sorry for the excessive delay in replying, I've not been paying enough attention to the issues emails :/
This seems like a good feature suggestion, and should be straight forward to implement.
A similar issue for the official Java SDK was resolved using a HEAD request: Backblaze/b2-sdk-java#28
As a workaround in the meantime, I would suggest GetFileInfo as an alternative to downloading the file content. Both of these are class B transactions. There's no information on whether a HEAD request would is charged differently than a GetFileInfo request.
When only the header information is required, the HEAD request provides a more efficient means of retrieving the headers than requesting the first few bytes of the file.
However, the download API HEAD method has the advantage that it has optional auth, so would allow existence checks for public objects without an authorization token.
After perusing the source code I'm wondering if there is an easier way to check if a file exists? Obviously, I could try to fetch the file and see if anything returns but this is an expensive operation. It would be nice if there was a function to wrap a basic HEAD request to check for the existence of a file.
The text was updated successfully, but these errors were encountered: