This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Google\CRC32\CRC32; | |
use GuzzleHttp\Psr7\Utils; | |
include __DIR__.'/vendor/autoload.php'; | |
$filePath = __DIR__.'/tests/System/data/5mb.txt'; | |
## USAGE: | |
# Paste the file into https://github.com/googleapis/google-cloud-php/tree/main/Storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
## Delete all topics and subscriptions with name having prefix: `gcloud_testing_` | |
use Google\Cloud\PubSub\PubSubClient; | |
$client = new PubSubClient(); | |
$topics = $client->topics(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
## Delete all buckets (and objects inside it) with bucket name having prefix: `gcloud_testing_` | |
use Google\Cloud\Storage\StorageClient; | |
$client = new StorageClient(); | |
$buckets = $client->buckets(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Ref: https://github.com/googleapis/google-cloud-php/issues/7088 | |
require __DIR__ . "/vendor/autoload.php"; | |
use Google\Cloud\Storage\StorageClient; | |
$gcsClient = new StorageClient([ | |
"projectId" => "XXXXXXX", | |
"requestTimeout" => 10, | |
]); | |
$gcsBucket = $gcsClient->bucket("XXXXXXX"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . "/vendor/autoload.php"; | |
use Google\Cloud\Storage\StorageClient; | |
use GuzzleHttp\Promise\Each; | |
// Create a Storage client | |
$storage = new StorageClient([ | |
'projectId' => 'XXXXXXXXXX', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
// https://github.com/googleapis/google-cloud-php/issues/5118 | |
// Warning: touch(): Google\Cloud\Storage\StreamWrapper::stream_metadata is not implemented! #5118 | |
// PR raised: https://github.com/googleapis/google-cloud-php/pull/7144 | |
use Google\Cloud\Storage\StorageClient; | |
$client = new StorageClient(['projectId' => 'XXXXXXXXXXX']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . "/vendor/autoload.php"; | |
use Google\Cloud\Storage\StorageClient; | |
use GuzzleHttp\Promise; | |
# control the number of objects to upload | |
$NUM_OBJECTS = 5; | |
$storage = new StorageClient(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Storage } from './build/esm/src/storage.js'; | |
// Path: nodejs-storage/issue_2389.js | |
const storage = new Storage(); | |
const myBucket = storage.bucket('thebookclub'); | |
const file = myBucket.file('sample.txt'); | |
file.copy('new_sample.txt', { | |
contentType: 'outer', // A property from CopyOptions | |
metadata: { | |
// Typed as FileMetadata |
OlderNewer