async function getExistingEtag()

in lib/recipes-data/src/lib/s3.ts [176:193]


async function getExistingEtag(
	Key: string,
	Bucket: string,
): Promise<string | undefined> {
	const check = new HeadObjectCommand({
		Bucket,
		Key,
	});

	try {
		const checkResponse = await s3Client.send(check);
		return checkResponse.ETag;
	} catch (e) {
		if (e instanceof NotFound) {
			console.log(`${Key} did not exist in ${Bucket}`);
		}
	}
}