sipp
Version:
An Opinionated, High-Productivity MVC Web Framework in TypeScript
23 lines (22 loc) • 891 B
TypeScript
/// <reference types="node" />
import { ReadStream } from 'fs';
import { Response } from 'express';
export declare type Downloadable = string | ReadStream | Buffer | object | Array<any>;
export declare class Download<DownloadType> {
readonly download: DownloadType;
readonly mimeType?: string;
readonly fileName: string;
static from(download: Downloadable, mimeType?: string, fileName?: string): StreamDownload | PathDownload | BufferDownload;
constructor(download: DownloadType, mimeType?: string, fileName?: string);
getFileName(): string;
}
export declare class StreamDownload extends Download<ReadStream> {
handle(res: Response): void;
}
export declare class BufferDownload extends Download<Buffer> {
handle(res: Response): void;
}
export declare class PathDownload extends Download<string> {
handle(res: Response): void;
getFileName(): string;
}