Skip to content

Commit 7fd77e6

Browse files
author
brecht.vermeersch
committed
improve performance of directory exists
1 parent 92f05c0 commit 7fd77e6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/AzureBlobStorageAdapter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use AzureOss\Storage\Blob\BlobContainerClient;
88
use AzureOss\Storage\Blob\Models\Blob;
99
use AzureOss\Storage\Blob\Models\BlobProperties;
10+
use AzureOss\Storage\Blob\Models\GetBlobsOptions;
1011
use AzureOss\Storage\Blob\Models\UploadBlobOptions;
1112
use AzureOss\Storage\Blob\Sas\BlobSasBuilder;
1213
use League\Flysystem\ChecksumAlgoIsNotSupported;
@@ -63,7 +64,9 @@ public function fileExists(string $path): bool
6364
public function directoryExists(string $path): bool
6465
{
6566
try {
66-
foreach($this->listContents($path, false) as $ignored) {
67+
$options = new GetBlobsOptions(pageSize: 1);
68+
69+
foreach($this->containerClient->getBlobs($this->prefixer->prefixDirectoryPath($path), $options) as $ignored) {
6770
return true;
6871
};
6972

0 commit comments

Comments
 (0)