Documentation
    Preparing search index...

    Storage adapter implementation targeting Supabase Storage. Interfaces with the @supabase/storage-js client to manage buckets, secure signed URLs, and file uploads.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _alias: string = ''
    _client: StorageClient
    _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

      • workingDirName: string

      Returns Promise<string>

    • Copies a file to a new destination key natively on the Supabase backend.

      Parameters

      Returns Promise<void>

    • Uploads a local file path or stream to the Supabase storage bucket.

      Parameters

      • file: FileType

        Target file schema.

      • stream: string | Readable

        Readable stream or string path to the file.

      Returns Promise<FileType>

      A promise resolving to the created file footprint.

      If upload is rejected.

    • Permanently removes the file from the Supabase bucket.

      Parameters

      Returns Promise<boolean>

      True upon success.

    • Downloads the file directly, either returning the blob content or saving it locally.

      Parameters

      Returns Promise<string | Blob>

      A promise resolving to the blob or local file path.

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

    • Exposes the underlying Supabase StorageClient instance.

      Returns StorageClient

      The storage client.

    • Downloads the file content to a temporary location and returns a Readable stream.

      Parameters

      Returns Promise<Readable>

      The content as a stream.

    • Get signed upload url for file Careful, on docker the time to live for JWT signature is defaulted to 60 sec Add SIGNED_UPLOAD_URL_EXPIRATION_TIME env variable to fix TTL

      Parameters

      • file: FileType

        FileType

      • _expiresIn: number = 7200

        actually ignored

      Returns Promise<FileResponseLinkType>

    • Generates a secure, temporary GET link to access the object remotely.

      Parameters

      • file: FileType

        The file footprint.

      • expiresIn: number = 3600

        URL expiration in seconds.

      • action: any = 'read'

        Intended action context.

      • extra: any = {}

        Optional parameters (e.g. cache configurations).

      Returns Promise<{ expiresIn: number; url: string }>

      A promise resolving to the signed URL payload.

      If signature creation fails.

    • 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 an existing file natively within Supabase Storage.

      Parameters

      Returns Promise<FileType>

      A promise resolving to the newly placed destination file.

      If the move operation fails.

    • Fetches and pipes the file content into the given response stream.

      Parameters

      • file: FileType

        File to stream.

      • res: any

        Writable stream or HTTP response object.

      Returns Promise<any>

      The piped stream instance.

    • Helper converting a node stream to a Buffer, essential for Blob creation.

      Parameters

      • stream: Stream

        The input stream.

      Returns Promise<Buffer<ArrayBufferLike>>

      A promise resolving to the concatenated Buffer.

    • Validates backend connectivity by listing available buckets in the Supabase project.

      Returns Promise<boolean>

      True if connected.

    • Internal helper to convert a Buffer into a native ArrayBuffer.

      Parameters

      • buffer: Buffer

        The raw Buffer.

      Returns ArrayBuffer

      The ArrayBuffer representation.