Skip to content

feat: support cross-bucket copy and move operations#18

Merged
thetutlage merged 7 commits into2.xfrom
feat/move-copy-other-bucket
Apr 7, 2026
Merged

feat: support cross-bucket copy and move operations#18
thetutlage merged 7 commits into2.xfrom
feat/move-copy-other-bucket

Conversation

@RomainLanz
Copy link
Copy Markdown
Member

@RomainLanz RomainLanz commented Mar 25, 2026

Hey! 👋🏻

This PR allows copy and move operations to target a different bucket instead of always operating within the same one. A new CopyMoveOptions type extends WriteOptions with an optional bucket property, so users can write:

disk.copy(src, dest, { bucket: 'other-bucket' })

Both the S3 and GCS drivers have been updated to use this destination bucket for the target while keeping the current bucket as the source. The change is fully backward compatible since omitting bucket behaves exactly as before.

Integration tests have been added for both S3 and GCS that pass the bucket option explicitly with the same bucket to validate the code path.

For S3 specifically, unit tests subclass the driver to verify that CopyObjectCommand receives the correct Bucket and CopySource values when a different destination bucket is provided.

True cross-bucket integration tests with a second real bucket are not included as they would require additional CI configuration.

@RomainLanz RomainLanz force-pushed the feat/move-copy-other-bucket branch from 666efa3 to df56700 Compare March 25, 2026 12:43
@RomainLanz RomainLanz force-pushed the feat/move-copy-other-bucket branch from df56700 to 1a49caf Compare March 25, 2026 12:46
Make the cross-bucket option name explicit about its purpose and
remove .catch() from S3 unit tests so they expect success.
Add debug logging to S3 copy and use env-configured other bucket
names instead of hardcoded non-existent bucket names.
Comment thread tests/drivers/gcs/copy.spec.ts
Comment thread tests/drivers/gcs/move.spec.ts
Comment thread src/types.ts
@RomainLanz
Copy link
Copy Markdown
Member Author

Should be good! 👍🏻

@thetutlage thetutlage merged commit d3eaa89 into 2.x Apr 7, 2026
18 of 36 checks passed
@thetutlage thetutlage deleted the feat/move-copy-other-bucket branch April 7, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants