You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still getting acquainted with managing s3 buckets programaticaly so bare with me...
I've written the following function using this lib:
/**
* Syncs a directory to an S3 bucket.
*
* @param syncFrom The local directory path to sync from.
* @param syncTo The S3 bucket path to sync to.
* @returns A Promise that resolves when the sync is complete.
*/
const syncDirectoryToS3 = async (syncFrom: string, syncTo: string): Promise<void> => {
// Sync wrapper for S3 Client
// www.npmjs.com/package/s3-sync-client
const {sync} = new S3SyncClient({client: new S3Client(AWS_CREDS)});
// Command input for content type
const commandInput = (input: any) => ({ContentType: mime.lookup(input.Key) || 'text/html'});
// Event listener for progress updates
const monitor = new TransferMonitor().on('progress', progress => progressUpdate(progress));
// Run sync command and update on progress
await sync(syncFrom, syncTo, {del: true, commandInput, monitor});
console.log(`\nTransfer complete: ${syncTo} is now synced with files from ${syncFrom}`);
};
I have del: true right there in the call to sync() at the end, but for some reason when I delete files locally and sync, they are still in the s3 bucket... anyone see anything overtly with this function?
How I tested:
Create folder foo locally and touch file1.txtfile2.txt
Run sync command above
List contents of foo
Delete file1.txt locally
Run sync command above
List contents of foo
file1.txt is still in the s3 bucket.
The text was updated successfully, but these errors were encountered:
I'm still getting acquainted with managing s3 buckets programaticaly so bare with me...
I've written the following function using this lib:
I have
del: true
right there in the call tosync()
at the end, but for some reason when I delete files locally and sync, they are still in the s3 bucket... anyone see anything overtly with this function?How I tested:
foo
locally and touchfile1.txt
file2.txt
foo
file1.txt
locallyfoo
file1.txt
is still in the s3 bucket.The text was updated successfully, but these errors were encountered: