Documentation
    Preparing search index...

    Git and GitHub Storage Adapter for Quatrain Core. Manages files locally via Git shell execution, or remotely via the GitHub REST API.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _alias: string = ''
    _client: any
    _params: StorageParameters = {}
    config: GitStorageConfig
    octokit:
        | Octokit & { paginate: PaginateInterface } & RestEndpointMethods & Api
        | null = null

    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

      • workingDirName: string

      Returns Promise<string>

    • Copies a file from one repository location to another.

      Parameters

      • file: FileType

        Source file footprint.

      • destFile: FileType

        Destination file footprint.

      Returns Promise<any>

      A promise resolving to the copied file metadata.

    • Creates a new file or updates an existing one in the git repository or GitHub.

      Parameters

      • file: FileType

        Target file metadata.

      • stream: Readable

        Readable stream containing the file content.

      Returns Promise<FileType>

      A promise resolving to the created file's metadata footprint.

    • Deletes a file from the repository and commits/pushes the change.

      Parameters

      Returns Promise<boolean>

      A promise resolving to true if the file was deleted, false otherwise.

    • 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 the Git repository storage.

      Parameters

      • Optionalbucket: string

        Optional bucket name (defaults to 'default').

      • Optionalprefix: string

        Optional directory prefix to scan.

      Returns Promise<BucketStatsType>

      A promise resolving to the bucket statistics.

    • Returns the underlying SDK or driver instance (Octokit for GitHub, fs-extra for local).

      Returns any

      The raw storage client or file system module.

    • Retrieves file metadata, specifically augmenting it with byte size.

      Parameters

      Returns Promise<FileType>

      A promise resolving to the file footprint containing sizes.

    • Retrieves the file content as a Readable stream.

      Parameters

      Returns Promise<Readable>

      A promise resolving to a Node Readable stream.

    • Generates a direct upload URL (returns the read URL since git upload is committed directly).

      Parameters

      • filePath: FileType

        Target file footprint.

      • OptionalexpiresIn: number

        Expiry window in seconds (ignored).

      Returns Promise<any>

      A promise resolving to the raw URL string.

    • Generates a raw URL pointing to the raw file content in Git/GitHub.

      Parameters

      • file: FileType

        Target file footprint.

      • OptionalexpiresIn: number

        Expiry window in seconds (ignored).

      • Optionalaction: string

        Action intent (ignored).

      • Optionalextra: any

        Provider specific overrides (ignored).

      Returns Promise<any>

      A promise resolving to the final raw public URL string.

    • 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.

    • Lists all files within the repository that match the prefix.

      Parameters

      • prefixOrOptions: any = ''

        Root prefix directory or options object.

      Returns Promise<string[]>

      A promise resolving to a list of matching file reference paths.

    • Moves/renames a file natively in the repository.

      Parameters

      • file: FileType

        Source file footprint.

      • destFile: FileType

        Destination file footprint.

      Returns Promise<any>

      A promise resolving to the relocated file footprint.

    • Parameters

      • cmd: string

      Returns Promise<void>

    • Pipes the file content directly into a writable stream.

      Parameters

      • file: FileType

        Target file footprint.

      • res: any

        Target writable stream.

      Returns Promise<any>

    • Parameters

      • stream: Readable

      Returns Promise<string>