I'm trying to get objects in my bucket on Google Cloud Storage. To do so I use the recommended code by Google on its API pages :
https://cloud.google.com/storage/docs/downloading-objects#storage-download-object-php
But when I do, I got a permission denied error.
I configured Composer with the permission (for example my code to list the objects within the bucket works fine) but I can't download anything. I get this error :
Warning: fopen(C:\wamp64\www\test): failed to open stream: Permission denied in C:\wamp64\www\test\vendor\google\cloud-storage\src\StorageObject.php on line 602
I gave myself all the permissions to in the Cloud Storage console but the error still appear.
I also wondered, is it possible to get/copy the content of the object without downloading it?
Thank you for your help!
EDIT : The code is pretty simple :
$storage = new StorageClient($config = [
'keyFilePath' => "[PATH OF MY KEYFILE]",
'projectId' => $projectId
]);
$bucket = $storage->bucket($bucketName);
$object = $bucket->object($objectName);
$object->downloadToFile($destination);
printf('Downloaded gs://%s/%s to %s' . PHP_EOL,
$bucketName, $objectName, basename($destination));
}
In the storage I just have buckets with a list of object and I need to get the content/dl one of them to merge it with another Json