-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
38 lines (34 loc) · 1.32 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
declare module "fastify-file-upload" {
import { FastifyInstance, FastifyPluginCallback, FastifyPluginOptions, FastifyRequest } from "fastify";
import { Server } from "http";
export function setMultipart(request: FastifyRequest, payload: any, done: () => void): void;
export function fastifyUpload(fastify: FastifyInstance, options: any, done: () => void): void;
const defaultValue: () => FastifyPluginCallback<FastifyPluginOptions, Server>;
export default defaultValue
}
type UploadedFile = {
/** file name */
name: string;
/** A function to move the file elsewhere on your server */
mv(path: string, callback: (error: unknown) => void): void;
mv(path: string): Promise<void>;
/** Encoding type of the file */
encoding: string;
/** The mimetype of your file */
mimetype: string;
/** A buffer representation of your file, returns empty buffer in case useTempFiles option was set to true. */
data: Buffer;
/** A path to the temporary file in case useTempFiles option was set to true. */
tempFilePath: string;
/** A boolean that represents if the file is over the size limit */
truncated: boolean;
/** Uploaded size in bytes */
size: number;
/** MD5 checksum of the uploaded file */
md5: string;
};
declare module "http" {
interface IncomingMessage {
files?: UploadedFile | UploadedFile[];
}
}