aws-amplify / aws-amplify/amplify-android

Retrieve metadata

Open
#2,805 7 comments 0 reactions 0 assignees View on GitHub
feature-request storage
Dominant language
Java
Stars
287
Forks
132
Avg merge
2d 2h
Merged PRs (30d)
45

Description

### Before opening, please confirm:

- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-android/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-android/discussions).

### Language and Async Model

Kotlin, Kotlin - Coroutines

### Amplify Categories

Storage

### Gradle script dependencies

```groovy
// Put output below this line
implementation 'com.amplifyframework:aws-storage-s3:2.16.0'

```

### Environment information

```
# Put output below this line

```

### Please include any relevant guides or documentation you're referencing

_No response_

### Describe the bug

Hi,

Hope you are fine.

I want to add some values to a file metadate. According to https://docs.amplify.aws/gen1/android/build-a-backend/storage/upload/ it can define a custom option and put metadata values there. When I check S3 files in the console I can file the metadata which has been stored.
```
File exampleFile = new File(getApplicationContext().getFilesDir(), "example");
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(exampleFile));
writer.append("Example file contents");
writer.close();
} catch (Exception exception) {
Log.e("MyAmplifyApp", "Upload failed", exception);
}

// Create metadata
Map userMetadata = new HashMap<>();
userMetadata.put("myKey", "myVal");

// Configure upload options with metadata
StorageUploadFileOptions options = StorageUploadFileOptions.builder()
.metadata(userMetadata)
.build();

// Perform the upload
Amplify.Storage.uploadFile(
StoragePath.fromString("public/example"),
exampleFile,
options,
result -> Log.i("MyAmplifyApp", "Successfully uploaded: " + result.getPath()),
error -> Log.e("MyAmplifyApp", "Upload failed", error)
);
```

However, I couldn't find a way to read metadata of downloaded file https://docs.amplify.aws/gen1/android/build-a-backend/storage/download/.

Can anyone explain how it is possible to retrieve metadata of a downloaded file?

Thanks

### Reproduction steps (if applicable)

_No response_

### Code Snippet

```java
// Put your code below this line.

```

### Log output

```
// Put your logs below this line

```

### amplifyconfiguration.json

_No response_

### GraphQL Schema

```graphql
// Put your schema below this line

```

### Additional information and screenshots

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Gen 1 Android Storage upload and download guides linked in the issue, then inspect the aws-storage-s3 download API and its metadata option. Determine whether downloaded-file metadata is supported and identify the expected public behavior; the issue is done when the supported retrieval path or its absence is clearly documented and covered by the relevant project tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, aws, java, kotlin
Domain
backend, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.