Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 16, 2024

Remove files

Files can be removed from a storage bucket using the 'remove' API. If a file is protected by an identity Id, only the user who owns the file will be able to remove it.

let removedObject = try await Amplify.Storage.remove(path: .fromString("public/example/path"))
print("Deleted \(removedObject)")
let sink = Amplify.Publisher.create {
try await Amplify.Storage.remove(path: .fromString("public/example/path"))
}.sink {
if case let .failure(error) = $0 {
print("Failed: \(error)")
}
}
receiveValue: { removedObject in
print("Deleted \(removedObject)")
}