Composables
The module provides the following functions via useS3Object composable.
Remove
The remove function can be used to delete a single object.
function remove(url: string): Promise<void> {}
The url refers to the object's download path which is /api/s3/query/{key}. The key uniquely identifies the object in the bucket.
Upload
The upload function can be used to upload a single object and set its metadata.
function upload(
file: File,
opts?: {
url?: string;
key?: string;
prefix?: string;
meta?: S3ObjectMetadata;
}
) {}
Two logics are performed
- Key naming: the object's key is by default a UUID. In order to organize objects in the bucket, you can assign to it a custom key
opts.keyor prefix the default viaopts.prefix. Please refer to AWS docs for guidelines. - Create or update: A new object is created and if
opts.urlis provided then the related object is deleted from the bucket.