@blocklet/uploader-server
Version:
blocklet upload server
32 lines (31 loc) • 959 B
TypeScript
export type DynamicResourcePath = {
path: string;
blacklist?: string[];
whitelist?: string[];
};
export type DynamicResourceOptions = {
componentDid?: string;
resourcePaths: DynamicResourcePath[];
watchOptions?: {
ignorePatterns?: string[];
persistent?: boolean;
usePolling?: boolean;
depth?: number;
};
cacheOptions?: {
maxAge?: string | number;
immutable?: boolean;
etag?: boolean;
lastModified?: boolean;
};
onFileChange?: (filePath: string, event: string) => void;
onReady?: (resourceCount: number) => void;
setHeaders?: (res: any, filePath: string, stat: any) => void;
conflictResolution?: 'first-match' | 'last-match' | 'error';
};
/**
* 创建动态资源中间件
*/
export declare function initDynamicResourceMiddleware(options: DynamicResourceOptions): ((req: any, res: any, next: Function) => any) & {
cleanup: () => void;
};