UNPKG

@aws-amplify/storage

Version:

Storage category of aws-amplify

36 lines (34 loc) 1.39 kB
'use strict'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.getProperties = void 0; const utils_1 = require("@aws-amplify/core/internals/utils"); const utils_2 = require("../../utils"); const client_1 = require("../../utils/client"); const userAgent_1 = require("../../utils/userAgent"); const utils_3 = require("../../../../utils"); const getProperties = async function (amplify, input, action) { const { key, options } = input; const { s3Config, bucket, keyPrefix } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, options); const finalKey = `${keyPrefix}${key}`; utils_3.logger.debug(`get properties of ${key} from ${finalKey}`); const response = await (0, client_1.headObject)({ ...s3Config, userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(action ?? utils_1.StorageAction.GetProperties), }, { Bucket: bucket, Key: finalKey, }); return { key, contentType: response.ContentType, size: response.ContentLength, eTag: response.ETag, lastModified: response.LastModified, metadata: response.Metadata, versionId: response.VersionId, }; }; exports.getProperties = getProperties; //# sourceMappingURL=getProperties.js.map