Skip to content

Instantly share code, notes, and snippets.

@SalvoCozzubo
Last active September 14, 2022 12:42
Show Gist options
  • Save SalvoCozzubo/067125955aa72a5ddd335e6f16fa448a to your computer and use it in GitHub Desktop.
Save SalvoCozzubo/067125955aa72a5ddd335e6f16fa448a to your computer and use it in GitHub Desktop.
copy file between bucket
const { CopyObjectCommand, S3Client } = require('@aws-sdk/s3-client');
const client = new S3Client({});
const moveFile = async (sourceKey, destBucket, destKey) => {
const params = {
Bucket: destBucket,
Key: destKey,
CopySource: sourceKey,
};
return client.send(new CopyObjectCommand(params));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment