express-cache-file
Version:
Express middleware to cache static files in server memory
15 lines (14 loc) • 379 B
TypeScript
/// <reference types="node" />
export type Content = {
buffer: Buffer;
mimeType: string;
expire?: number;
};
export type Cache = {
capacity?: number;
usedSize: number;
expireInterval?: number;
files: Record<string, Content>;
};
export type Callback = (err: any, content: Content) => void;
export type GetFileFn = (file: string, cb: Callback) => void;