This file contains hidden or 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
// Paste the below script in console and press enter | |
// Below code clicks on all links such as "Load Diff: Large diffs are not rendered by default." | |
// Clicking loads the file from GH backend which are not shown during a page load due to large files | |
``` | |
document.querySelectorAll('span.Button-label > div.text-bold.f4.js-button-text').forEach(div => { | |
div.click(); | |
}); | |
``` |
This file contains hidden or 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 | |
// https://github.com/googleapis/google-cloud-php/issues/7343 | |
require __DIR__ . "/vendor/autoload.php"; | |
use Google\Cloud\Storage\StorageClient; | |
function dbug($stream) | |
{ | |
var_dump(is_resource($stream)); | |
var_dump(get_resource_type($stream)); | |
var_dump(stream_get_meta_data($stream)); |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder