hono-upload
Version:
A memory efficient upload handler for hono.
25 lines • 831 B
TypeScript
/// <reference types="node" />
import type { Context } from 'hono';
import type { Readable } from 'stream';
type UploadFileInfo = {
filename: string;
encoding: string;
mimeType: string;
field: string;
};
export type UploadParams<T, Ctx extends Context> = {
onFile: (file: Readable, fileInfo: UploadFileInfo) => T | Promise<T>;
queuingStrategy?: QueuingStrategy<Uint8Array>;
ctx: Ctx;
maxFileSize?: number;
};
export declare const uploadErrors: {
MISSING_BODY: string;
INVALID_CONTENT_TYPE: string;
CONTENT_LENGTH_MISSING: string;
MAX_FILE_SIZE_EXCEEDED: string;
MAX_ONE_FILE_ALLOWED: string;
};
export declare function uploadHandler<T, C extends Context>({ queuingStrategy, onFile, ctx, ...params }: UploadParams<T, C>): Promise<T>;
export {};
//# sourceMappingURL=index.d.ts.map