Documentation
    Preparing search index...

    Storage adapter implementation for AWS S3 compatible services. Implements direct stream uploads, presigned URLs, and multipart handling.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _alias: string = ''
    _client: S3Client
    _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 an existing object within S3 to a new destination key or bucket.

      Parameters

      Returns Promise<void>

    • Uploads a file stream directly into an S3 Bucket.

      Parameters

      • file: FileType

        Target file metadata.

      • stream: Readable

        The content readable stream.

      Returns Promise<FileType>

      A promise resolving to the uploaded FileType metadata.

      If the upload fails.

    • Deletes an object from the S3 Bucket.

      Parameters

      Returns Promise<boolean>

      A promise resolving to true on success.

    • 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 in S3. Iterates over all objects in the bucket to compute total count and size.

      Parameters

      • Optionalbucket: string

        Target bucket name.

      • Optionalprefix: string

      Returns Promise<BucketStatsType>

      A promise resolving to bucket statistics.

    • Exposes the underlying AWS S3 Client instance.

      Returns S3Client

      The S3Client instance.

    • Issues a HEAD request to fetch S3 object metadata like size and content-type without downloading the actual payload.

      Parameters

      Returns Promise<FileType>

      A promise resolving to the augmented metadata.

    • Downloads an S3 object and returns it as a Node.js Readable stream.

      Parameters

      Returns Promise<Readable>

      A promise resolving to the ReadStream.

    • Generates a presigned PUT URL allowing clients to upload directly to S3, bypassing the backend.

      Parameters

      • file: FileType

        The requested upload file destination.

      • expiresIn: number = 3600

        Token expiration in seconds.

      Returns Promise<FileResponseLinkType>

      A promise resolving to the upload URL instructions.

    • Generates a temporary, presigned GET URL for public or secure access.

      Parameters

      • file: FileType

        Target file.

      • expiresIn: number = 3600

        URL expiration time in seconds.

      • action: any = 'read'

        The requested action ('read', etc.).

      • extra: any = {}

        Extra parameters such as 'cacheControl'.

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

      A promise resolving to the generated URL and expiration 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.

    • Directly pipes an S3 object to an external HTTP response or stream.

      Parameters

      • file: FileType

        Target file.

      • res: any

        The response or writable stream.

      Returns Promise<any>

      The piped stream instance.

    • Helper utility converting a Node.js Stream into a raw Buffer. Required for S3 payloads when streaming sizes are indeterminate.

      Parameters

      • stream: Stream

        The input stream.

      Returns Promise<Buffer<ArrayBufferLike>>

      A promise resolving to the concatenated Buffer.

    • Validates the connection to the configured S3 endpoint by attempting to list buckets.

      Returns Promise<boolean>

      True if the connection succeeds and buckets are accessible.