pub fn exists(
ctx: &Ctx,
key: &str,
) -> impl Future<Output = Result<bool>> + Send + use<>Expand description
Returns whether an object exists at key (Active Storage’s exist?); a head without the details.
Free plan: one R2 class B operation (10M free per month).
§Errors
Error::Internal (500) when the STORAGE
binding is missing or R2 fails.
§Examples
use axum::extract::{Path, State};
use ocre::{Ctx, Result, storage};
async fn check(State(ctx): State<Ctx>, Path(key): Path<String>) -> Result<String> {
Ok(storage::exists(&ctx, &key).await?.to_string())
}