import { Readable } from "stream"; import { ConfigService } from "@nestjs/config"; import { ClsService } from "nestjs-cls"; import { BaseConfigInterface } from "../../../config/interfaces"; import { JsonApiDataInterface } from "../../../core/jsonapi/interfaces/jsonapi.data.interface"; import { JsonApiService } from "../../../core/jsonapi/services/jsonapi.service"; import { AppLoggingService } from "../../../core/logging/services/logging.service"; export declare class S3Service { private readonly builder; private readonly clsService; private readonly configService; private readonly logger; private s3Client; private blobServiceClient; private containerClient; private _bucket; private _endpoint; private _storageType; constructor(builder: JsonApiService, clsService: ClsService, configService: ConfigService, logger: AppLoggingService); private get s3Config(); private _loadConfiguration; private _prepareUrl; private _prepareAzureUrl; generatePresignedUrl(params: { key: string; contentType: string; ttl?: 3600; isPublic: boolean; }): Promise; deleteFolderFromS3(params: { key: string; }): Promise; private _deleteAzureFolder; deleteFileFromS3(params: { key: string; }): Promise; private _deleteAzureFile; /** * Builds an RFC 6266 `attachment` Content-Disposition value. The ASCII fallback strips * characters that would break the header (quotes, path separators, control chars) while * `filename*` carries the original UTF-8 name for browsers that support it. */ private _contentDispositionAttachment; findSignedUrl(params: { key: string; isPublic?: boolean; filename?: string; }): Promise; generateSignedUrl(params: { key: string; ttl?: number; isPublic?: boolean; filename?: string; }): Promise; private _generateAzureSignedUrl; uploadFile(params: { buffer: Buffer; key: string; contentType?: string; }): Promise<{ fileUrl: string; filePath: string; }>; private _uploadAzureFile; uploadImageBuffer(params: { buffer: Buffer; key: string; }): Promise<{ imageUrl: string; imagePath: string; }>; private _uploadAzureImage; private getContentType; uploadToAzureFromBuffer(params: { buffer: Buffer; key: string; contentType: string; }): Promise<{ fileUrl: string; filePath: string; }>; uploadToS3(params: { buffer: Buffer; key: string; contentType: string; isPublic?: boolean; }): Promise; getObjectContent(params: { key: string; }): Promise; private _getAzureObjectContent; /** * Single-page list for streaming consumers. Unlike listObjects (which accumulates every page * into one array), this returns one page plus the continuation token so the caller can resume * on demand. StartAfter lets a caller resume after a known key; it is ignored when * ContinuationToken is set. */ listObjectsPage(params: { prefix: string; startAfter?: string; continuationToken?: string; maxKeys?: number; }): Promise<{ objects: { key: string; size: number; }[]; nextContinuationToken?: string; }>; /** * Download a file from S3/Azure and return both its buffer and the response Content-Type. * Used by workers that hash + re-upload while preserving the original content type. */ downloadFileBuffer(params: { key: string; }): Promise<{ buffer: Buffer; contentType?: string; }>; /** * Upload a readable stream with an exact key using multipart upload. * Unlike uploadBufferWithKey, this streams data without holding the full content in memory. */ uploadStream(params: { key: string; contentType: string; stream: Readable; }): Promise; /** * Copy a file from one location to another within the same bucket/container. * Supports both S3-compatible storage and Azure Blob Storage. */ copyFile(params: { sourceKey: string; destinationKey: string; }): Promise; /** * List all objects under a given prefix. * Handles pagination for S3-compatible storage and Azure. */ listObjects(params: { prefix: string; }): Promise<{ key: string; size: number; }[]>; private _listAzureObjects; /** * Download a file from S3/Azure and return its content as a string. * Useful for reading JSON or HTML content stored in object storage. */ downloadFileAsString(params: { key: string; }): Promise; private _downloadAzureFileAsString; /** * Download a file from S3/Azure and return its content as a Buffer. * Useful for reading binary files like attachments. */ downloadFileAsBuffer(params: { key: string; }): Promise; private _downloadAzureFileAsBuffer; /** * Download a file from S3/Azure and return a readable stream. * Memory-efficient for large files like ZIP archives. */ downloadFileAsStream(params: { key: string; }): Promise; private _downloadAzureFileAsStream; /** * Upload a buffer with an exact key — NO extension appending. * Unlike uploadFile (which adds .pdf, .zip, etc.), this method * preserves the key exactly as provided. */ uploadBufferWithKey(params: { buffer: Buffer; key: string; contentType: string; }): Promise; } //# sourceMappingURL=s3.service.d.ts.map