Replies: 3 comments 6 replies
-
Hey @tacman 👋 I've converted it to a discussion. Thanks for the suggestion.
I don't know if it's currently possible without doing it recursive like you've already suggested. The API specs denote that it just retrieves a list of files and directories located in the given directory. If you want a definitive answer, I'd recommend creating a ticket at the bunny support desk and ask them directly. You can explain you're current situation, what you're trying to achieve, and ask if they have any suggestions on how to handle such a migration. As you've mentioned S3 (I assume you're migration from S3 to Bunny storage zones) you might be interested in asking on where they stand regarding S3 compatibility for the storage zones: https://bunny.net/blog/whats-happening-with-s3-compatibility/. |
Beta Was this translation helpful? Give feedback.
-
Coincidentally, I posted a message to that blog post this morning. And I've reached out to their support. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Indeed, the Flysystem adapter for bunny implements it as a recursive call. public function listContents(string $path, bool $deep): iterable
{
try {
$entries = $this->client->list($path);
// @codeCoverageIgnoreStart
} catch (Exceptions\BunnyCDNException $e) {
throw UnableToRetrieveMetadata::create($path, 'folder', $e->getMessage());
}
// @codeCoverageIgnoreEnd
foreach ($entries as $item) {
$content = $this->normalizeObject($item);
yield $content;
if ($deep && $content instanceof DirectoryAttributes) {
foreach ($this->listContents($content->path(), $deep) as $deepItem) {
yield $deepItem;
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Is there a way to download the metadata of all the objects in a storageZone? Obviously, a recursive function that calls listFiles() and/or listContents() would work, but generate many API calls if there are a lot of directories.
I have a million objects, each object has 0 or more photos and the photos and metadata for each object is in a directory keyed by the object id. S3 doesn't really have directories, so this approach is fine, but I'm wondering if I need to restructure if we migrate to Bunny.
Bunny allows up to 50,000 files per directory, but recommends a max of 10,000. That makes sense, since there's no pagination so the JSON response will get pretty big.
Beta Was this translation helpful? Give feedback.
All reactions