Skip to content

🎥 Make videos programmatically with React

802 B
Raw Blame
import {DeleteObjectCommand} from '@aws-sdk/client-s3';
import type {DeleteFile} from './aws-operations';
import {getS3Client} from './get-s3-client';
import type {AwsRegion} from './regions';
import type {CustomCredentials} from './shared-constants';
import type {RequestHandler} from './types';

export const lambdaDeleteFileImplementation: DeleteFile = async ({
	bucketName,
	key,
	region,
	customCredentials,
	forcePathStyle,
	requestHandler,
}: {
	region: AwsRegion;
	bucketName: string;
	key: string;
	customCredentials: CustomCredentials | null;
	forcePathStyle: boolean;
	requestHandler: RequestHandler | null;
}) => {
	await getS3Client({
		region,
		customCredentials,
		forcePathStyle,
		requestHandler,
	}).send(
		new DeleteObjectCommand({
			Bucket: bucketName,
			Key: key,
		}),
	);
};