Service for working with Google Cloud Storage

Constructors

Properties

logger: WinstonLogger = ...
loggerFactory: WinstonLoggerFactory

Methods

  • Returns google storage bucket by name

    Parameters

    • name: string

      bucket name

    Returns Bucket

    google storage bucket

    if bucket not found

    const bucket = this.gcsService.getBucket('hc-auth-assets');
    
  • Returns google storage bucket by find options

    Parameters

    Returns Bucket

    google storage bucket

    if bucket not found

    const bucket = this.gcsService.getBucketBy({
    name: 'hc-auth-assets',
    });

    const bucket = this.gcsService.getBucketBy({
    alias: 'assets',
    });
  • Method is used to retrieve the host URL of a Google Cloud Storage bucket based on its alias.

    Parameters

    • alias: string

      bucket alias (e.g. 'assets')

    Returns string

    google storage bucket host

    const bucket = this.gcsService.getBucketHost('assets');

    // bucket = 'https://storage.googleapis.com/hc-auth-assets'
  • Checks if bucket exists in config

    Parameters

    • name: string

      bucket name

    Returns undefined | boolean

    • true if bucket exists in config
  • Parameters

    • bucket: string

    Returns boolean

  • Parameters

    • mediaUrl: string

    Returns GCSLocation