Page updated Jan 16, 2024

Get file properties

You can get file properties and metadata without downloading the file using Storage.getProperties API

1async function getFileProperties() {
2 try {
3 const result = await Storage.getProperties('key');
4 console.log('File Properties ', result);
5 } catch (error) {
6 console.log('Error ', error);
7 }
8}

The format of the response will look similar to the below example

1{
2 contentType: "image/jpeg",
3 contentLength: 6873,
4 eTag: "\"56b32cf4779ff6ca3ba3f2d455fa56a7\"",
5 lastModified: Wed Apr 19 2023 14:20:55 GMT-0700 (Pacific Daylight Time) {},
6 metadata: { owner : 'aws'}
7}