How to use the @google-cloud/storage function in @google-cloud/storage

To help you get started, we’ve selected a few @google-cloud/storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github material-components / material-components-web-react / test / screenshot / screenshot.tsx View on Github external
const serviceAccountKey: string = process.env.MDC_GCLOUD_SERVICE_ACCOUNT_KEY || '';
const branchName = process.env.MDC_BRANCH_NAME;
const commitHash = process.env.MDC_COMMIT_HASH;
const goldenFilePath = './test/screenshot/golden.json';
const bucketName = 'screenshot-uploads';
const defaultMetadata = {
  commit: commitHash,
  branch: branchName,
};

const NO_MATCH_DIRECTORY = 'no_match';

let storage: Storage|null = null;
let bucket: Storage.Bucket|null = null;
if (serviceAccountKey) {
  storage = new Storage({
    credentials: JSON.parse(serviceAccountKey),
  });

  bucket = storage.bucket(bucketName);
}

export default class Screenshot {
  urlPath_: string;
  /**
   * @param {string} urlPath The URL path to test
   */
  constructor(urlPath: string) {
    /** @private {string} */
    this.urlPath_ = urlPath;
    // TODO allow clients to specify capture-chrome options, like viewport size
  }
github RocketChat / Rocket.Chat / packages / rocketchat-file-upload / ufs / GoogleStorage / server.js View on Github external
constructor(options) {
		super(options);

		const gcs = gcStorage(options.connection);
		this.bucket = gcs.bucket(options.bucket);

		options.getPath = options.getPath || function(file) {
			return file._id;
		};

		this.getPath = function(file) {
			if (file.GoogleStorage) {
				return file.GoogleStorage.path;
			}
			// Compatibility
			// TODO: Migration
			if (file.googleCloudStorage) {
				return file.googleCloudStorage.path + file._id;
			}
		};
github nodestream / nodestream / packages / nodestream-gcs / lib / nodestream-gcs.es View on Github external
constructor(config) {
    this[scope] = {
      client: gcs(config).bucket(config.bucket),
    }
  }
github staylor / graphql-wordpress / packages / draft / src / server / uploads / adapter.js View on Github external
constructor(uploadDir) {
    this.uploadDir = uploadDir;
    const storage = new Storage({
      credentials,
    });
    this.bucket = storage.bucket(bucketName);
  }
github syndbg / webpack-google-cloud-storage-plugin / src / index.js View on Github external
connect() {
    if (this.isConnected) {
      return;
    }

    this.client = gcs(
      merge(
        this.storageOptions,
        {
          promise: Promise,
        }
      )
    );

    this.isConnected = true;
  }

@google-cloud/storage

Cloud Storage Client Library for Node.js

Apache-2.0
Latest version published 12 days ago

Package Health Score

91 / 100
Full package analysis