UNPKG

medusa-file-minio

Version:

MinIO server file connector for Medusa

44 lines (43 loc) 2 kB
/// <reference types="multer" /> /// <reference types="node" /> import { AbstractFileService, IFileService } from "@medusajs/medusa"; import { DeleteFileType, FileServiceUploadResult, GetUploadedFileType, UploadStreamDescriptorType } from "@medusajs/types"; import { ClientConfiguration } from "aws-sdk/clients/s3"; import aws from "aws-sdk"; import stream from "stream"; declare class MinioService extends AbstractFileService implements IFileService { protected bucket_: string; protected accessKeyId_: string; protected secretAccessKey_: string; protected private_bucket_: string; protected private_access_key_id_: string; protected private_secret_access_key_: string; protected endpoint_: string; protected s3ForcePathStyle_: boolean; protected signatureVersion_: string; protected downloadUrlDuration: string | number; constructor({}: {}, options: any); protected buildUrl(bucket: string, key: string): string; upload(file: Express.Multer.File): Promise<FileServiceUploadResult>; uploadProtected(file: Express.Multer.File): Promise<FileServiceUploadResult>; protected uploadFile(file: Express.Multer.File, options?: { isProtected: boolean; }): Promise<{ url: string; key: string; }>; delete(file: DeleteFileType): Promise<void>; getUploadStreamDescriptor(fileData: UploadStreamDescriptorType & { contentType?: string; }): Promise<{ writeStream: stream.PassThrough; promise: Promise<aws.S3.ManagedUpload.SendData>; url: string; fileKey: string; }>; getDownloadStream(fileData: GetUploadedFileType): Promise<stream.Readable>; getPresignedDownloadUrl({ isPrivate, ...fileData }: GetUploadedFileType): Promise<string>; validatePrivateBucketConfiguration_(usePrivateBucket: boolean): void; protected getClient(usePrivateBucket?: boolean, additionalConfiguration?: Partial<ClientConfiguration>): aws.S3; } export default MinioService;