Skip to content

Conversation

@vicb
Copy link
Contributor

@vicb vicb commented Nov 14, 2025

Add support for wrangler r2 bulk put bucket-name --filename list.json

// list.json
[
  { "key": "/path/to/obj", "file": "/path/to/file"},
  // ...
]

It supports the same options as wrangler r2 object put, minus --file and --pipe and plus --concurrency

Notes for reviewers:

  • r2/helpers.ts has been splitted into different files r2/helpers/<what.ts>
  • helpers outside of object.ts (used by the bulk command) are unchanged
  • there is one new helper bulk.ts

Future work (will create issues before merging this PR)

  • allow to override metadata for individual object
  • wrangler r2 bulk put bucket-name --folder /path/to/folder to upload a folder to R2
  • wrangler r2 bulk get bucket-name --folder /path/to/folder to download a folder from R2

TODO:

  • update for p-queue v9
  • e2e tests
  • local unit tests
  • add a changeset

  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: auto-generated from the command
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: not a patch change

@vicb vicb requested a review from a team as a code owner November 14, 2025 17:22
@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

🦋 Changeset detected

Latest commit: 12b99a7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vicb vicb marked this pull request as draft November 14, 2025 17:22
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Nov 14, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11285

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11285

miniflare

npm i https://pkg.pr.new/miniflare@11285

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11285

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11285

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11285

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11285

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11285

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11285

wrangler

npm i https://pkg.pr.new/wrangler@11285

commit: 12b99a7

@vicb vicb force-pushed the vicb/r2-batch branch 5 times, most recently from 9f43ef1 to 8669d35 Compare November 17, 2025 07:41
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is extracted from the former r2/helper.ts without updates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is extracted from the former r2/helper.ts without updates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is extracted from the former r2/helper.ts without updates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is extracted from the former r2/helper.ts without updates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is extracted from the former r2/helper.ts without updates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is extracted from the former r2/helper.ts without updates

@vicb vicb marked this pull request as ready for review November 17, 2025 07:45
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - with a few nits

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Nov 17, 2025
@vicb
Copy link
Contributor Author

vicb commented Nov 17, 2025

Thanks for the review Pete, I have applied your feedback

@vicb vicb merged commit d014fa7 into main Nov 17, 2025
37 of 40 checks passed
@vicb vicb deleted the vicb/r2-batch branch November 17, 2025 14:02
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants