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

Page updated May 21, 2024

LegacyYou are viewing Gen 1 documentation. Switch to the latest Gen 2 docs →

Get file properties

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

async function getFileProperties() {
try {
const result = await Storage.getProperties('key');
console.log('File Properties ', result);
} catch (error) {
console.log('Error ', error);
}
}

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

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