This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
forked from gmenih/multer-s3
-
Notifications
You must be signed in to change notification settings - Fork 13
Not able to use it in typescript project #18
Comments
i have build this type def please create and publish a type def library if anyone wants to use it for now,
declare module 'multer-s3-transform' {
// import { S3Client } from '@aws-sdk/client-s3';
import S3 from 'aws-sdk/clients/s3';
import { StorageEngine } from "multer";
import { Sharp } from 'sharp'
interface Itransform {
id: string; //'original'/ 'thumbnail'
key?(req: Express.Request, file: Express.Multer.File, callback: (error: any, key?: string) => void): void;
transform(req: Express.Request, file: Express.Multer.File, callback: (error: any, sharpInstance: Sharp) => void): void;
}
interface Options {
s3: S3;
bucket: ((req: Express.Request, file: Express.Multer.File, callback: (error: any, bucket?: string) => void) => void) | string;
key?(req: Express.Request, file: Express.Multer.File, callback: (error: any, key?: string) => void): void;
acl?: ((req: Express.Request, file: Express.Multer.File, callback: (error: any, acl?: string) => void) => void) | string | undefined;
contentType?(req: Express.Request, file: Express.Multer.File, callback: (error: any, mime?: string, stream?: NodeJS.ReadableStream) => void): void;
contentDisposition?: ((req: Express.Request, file: Express.Multer.File, callback: (error: any, contentDisposition?: string) => void) => void) | string | undefined;
metadata?(req: Express.Request, file: Express.Multer.File, callback: (error: any, metadata?: any) => void): void;
cacheControl?: ((req: Express.Request, file: Express.Multer.File, callback: (error: any, cacheControl?: string) => void) => void) | string | undefined;
serverSideEncryption?: ((req: Express.Request, file: Express.Multer.File, callback: (error: any, serverSideEncryption?: string) => void) => void) | string | undefined;
shouldTransform?(req: Express.Request, file: Express.Multer.File, callback: (error: any, should: boolean) => void): void;
transforms?: Itransform[];
}
interface S3Storage {
(options?: Options): StorageEngine;
AUTO_CONTENT_TYPE(
req: Express.Request,
file: Express.Multer.File,
callback: (error: any, mime?: string, stream?: NodeJS.ReadableStream) => void): void;
DEFAULT_CONTENT_TYPE(
req: Express.Request,
file: Express.Multer.File,
callback: (error: any, mime?: string) => void): void;
}
declare const s3Storage: S3Storage;
export = s3Storage;
}
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: