Documentation
    Preparing search index...

    Class AbstractStorageAdapterAbstract

    Base abstract class defining the contract for all storage adapters. Implements common logic for media thumbnailing and URL routing via gateways.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _alias: string = ''
    _client: any
    _params: StorageParameters = {}

    Methods

    • Parameters

      • file: FileType
      • size: number
      • workingDir: string
      • bucketDir: string
      • thumbnailExtension: string
      • imagePath: string

      Returns Promise<{ [key: string]: string }>

    • Parameters

      Returns { bucketDir: any; extension: any; name: any }

    • Parameters

      Returns boolean

    • Parameters

      • workingDirName: string

      Returns Promise<string>

    • Copies an existing file natively within the backend.

      Parameters

      Returns Promise<any>

    • Uploads a file stream to the storage backend.

      Parameters

      • file: FileType

        Target file metadata.

      • stream: Readable

        Readable data stream.

      Returns Promise<FileType>

      A promise resolving to the uploaded File footprint.

    • Deletes a file from the backend storage.

      Parameters

      Returns Promise<boolean>

      True if successful.

    • Extracts the first page of a document (e.g. PDF) via ImageMagick, resizes it, and uploads it as a thumbnail.

      Parameters

      • file: FileType

        Original document footprint.

      • sizes: number[]

        Array of desired thumbnail dimensions (px).

      Returns Promise<any>

      A mapping of generated thumbnail identifiers to their respective storage refs.

    • Downloads an image, generates resized thumbnails via sharp, and uploads them back.

      Parameters

      • file: FileType

        Original image footprint.

      • sizes: number[]

        Array of desired thumbnail dimensions (px).

      Returns Promise<any>

      A mapping of generated thumbnail identifiers to their respective storage refs.

    • Entry point for thumbnail generation. Analyzes the content type and automatically delegates to the appropriate generation strategy (Image, Video, or Document).

      Parameters

      • file: FileType

        Target file footprint.

      • sizes: number[]

        Desired dimensions.

      Returns Promise<any>

      The generated thumbnail map, or an empty object if unsupported/failed.

    • Extracts a single frame from a remote video via ffmpeg, resizes it, and uploads the frame as an image thumbnail.

      Parameters

      • file: FileType

        Original video footprint.

      • sizes: number[]

        Array of desired thumbnail dimensions (px).

      Returns Promise<any>

      A mapping of generated thumbnail identifiers to their respective storage refs.

    • Computes statistics for a given bucket.

      Parameters

      • Optionalbucket: string

        Target bucket name.

      • Optionalprefix: string

        Optional directory prefix.

      Returns Promise<BucketStatsType>

      A promise resolving to bucket statistics.

    • Returns the underlying SDK or driver instance.

      Returns any

      The raw storage client.

    • Retrieves extended object metadata (like byte size and content-type) from the backend.

      Parameters

      Returns Promise<FileType>

      The augmented metadata block.

    • Connects to the backend and returns a Node Readable stream of the file content.

      Parameters

      Returns Promise<Readable>

      A promise resolving to the ReadStream.

    • Generates a direct-to-provider upload URL, bypassing the application server.

      Parameters

      • filePath: FileType

        The intended file footprint.

      • OptionalexpiresIn: number

        Expiration of the upload link.

      Returns Promise<any>

    • Generates a raw, natively routable provider URL (e.g., S3 presigned URL).

      Parameters

      • file: FileType

        The target file footprint.

      • OptionalexpiresIn: number

        Signature expiration in seconds.

      • Optionalaction: string

        Intended action ('read', 'write').

      • Optionalextra: any

        Provider-specific overrides (e.g. { native: true }).

      Returns Promise<any>

      A promise resolving to the final native URL payload.

    • Checks if the file is a video or audio stream based on its MIME type or file extension.

      Parameters

      Returns boolean

      True if the file represents a video or audio asset.

    • Moves/renames a file natively within the backend.

      Parameters

      Returns Promise<any>

    • Directly pipes the remote file to a given local stream or HTTP response.

      Parameters

      • file: FileType

        File footprint.

      • res: any

        Output writable stream.

      Returns Promise<any>