@blocklet/uploader-server
Version:
blocklet upload server
57 lines (56 loc) • 2.13 kB
TypeScript
import type { Method } from 'axios';
export declare let logger: Console;
type CallComponentOptions<D = any, P = any> = {
name?: string;
method?: Method;
path: string;
data?: D;
params?: P;
headers?: {
[key: string]: any;
};
};
export declare function getTrustedDomainsCache({ forceUpdate, ttl, }?: {
forceUpdate?: boolean;
ttl?: number;
}): Promise<string[]>;
export declare function checkTrustedReferer(req: any, res: any, next?: Function): Promise<any>;
export declare function proxyImageDownload(req: any, res: any, next?: Function): Promise<void>;
export declare function setPDFDownloadHeader(req: any, res: any): void;
export declare const getFileHash: (filePath: string, maxBytes?: number) => Promise<any>;
export declare function uploadToMediaKit({ filePath, fileName, base64, extraComponentCallOptions, }: {
filePath?: string;
fileName?: string;
base64?: string;
extraComponentCallOptions?: CallComponentOptions;
}): Promise<import("axios").AxiosResponse<import("http").IncomingMessage, any> | undefined>;
export declare function getMediaKitFileStream(filePath: string): Promise<import("axios").AxiosResponse<import("http").IncomingMessage, any>>;
export type ResourceFile = {
filePath: string;
dir: string;
originDir: string;
blockletInfo: any;
whitelist?: string[];
blacklist?: string[];
mtime: Date;
size: number;
contentType: string;
};
export declare function calculateCacheControl(maxAge?: string | number, immutable?: boolean): {
cacheControl: string;
cacheControlImmutable: string;
maxAgeInSeconds: number;
};
export declare function serveResource(req: any, res: any, next: Function, resource: ResourceFile, options?: any): void;
export declare function scanDirectory(directory: string, options?: {
whitelist?: string[];
blacklist?: string[];
originDir?: string;
blockletInfo?: any;
}): Map<string, ResourceFile>;
export declare function getFileNameFromReq(req: any): any;
/**
* Remove EXIF from file
*/
export declare const removeExifFromFile: (filePath: string) => Promise<void>;
export {};