Comments (1)
i have build this type def please create and publish a type def library
if anyone wants to use it for now,
- in tsconfig.json file
"typeRoots": [
"./node_module/@types",
"./src/types" // add this typeroot
]
- now inside the /src/types folder create multer-s3-transform/index.d.ts file and paste the bellow code
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;
}
from multer-s3.
Related Issues (11)
- Passing variable with transforms option
- Video transforms
- is-svg high priority vulnerability HOT 5
- TypeError: Cannot read property 'length' of undefined
- AUTO_CONTENT_TYPE does not support SVGs
- Support for AWS-SDK v3 HOT 1
- Is possible decompress a file/dir and sending all files to s3?
- Content Disposition not working for images that go via transforms HOT 1
- Typos in resize snippet HOT 1
- cannot change contentType to webp HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multer-s3.