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

Page updated May 1, 2024

Remove files

Delete stored data from the storage bucket. To remove a file, you need to provide the fully specified path.

Files can only be deleted for the current user. Deletion capabilities do not extend to files associated with other users.

import { remove } from 'aws-amplify/storage';
try {
await remove({
path: 'public/album/2024/1.jpg',
// Alternatively, path: ({identityId}) => `protected/${identityId}/album/2024/1.jpg`
});
} catch (error) {
console.log('Error ', error);
}
import { remove } from 'aws-amplify/storage';
try {
await remove({
key: 'album/2024/1.jpg',
options: {
accessLevel: 'guest' // defaults to `guest` but can be 'private' | 'protected' | 'guest'
}
});
} catch (error) {
console.log('Error ', error);
}