import XNode from "./html/XNode.js";
import { LocalFile } from "./core/LocalFile.js";
import { SessionUser } from "./core/SessionUser.js";
import { WrappedResponse } from "./core/Wrapped.js";
import { OutgoingHttpHeaders } from "http";
import { Readable } from "stream";
export interface IContent {
body?: string | Buffer | XNode;
status?: number;
contentType?: string;
headers?: OutgoingHttpHeaders;
suppressLog?: boolean;
compress?: boolean;
}
export default class Content {
readonly reader: Readable;
readonly status: number;
readonly contentType: string;
readonly headers: OutgoingHttpHeaders;
suppressLog: boolean;
constructor(p: Partial);
send(res: WrappedResponse, user?: SessionUser): Promise;
static readable(readable: Readable, { status, headers }: {
status?: number;
headers?: OutgoingHttpHeaders;
}): Content;
static html(text: string | Iterable | XNode, { status, headers, contentType, compress, suppressLog }?: {
status?: number;
headers?: OutgoingHttpHeaders;
contentType?: string;
compress?: boolean;
suppressLog?: boolean;
}): Content;
static create(p: IContent): Content;
/**
* Do not use this to serialize large objects
* @param m model
* @returns string
*/
static nativeJson(m: any, { status, headers }?: {
status?: number;
headers?: OutgoingHttpHeaders;
}): Content;
static text(text: string | Buffer | Iterable | XNode, { status, headers, contentType, suppressLog }?: {
status?: number;
headers?: OutgoingHttpHeaders;
contentType?: string;
suppressLog?: boolean;
}): Content;
}
export declare class StatusResult extends Content {
constructor(status: any, headers: OutgoingHttpHeaders);
send(res: WrappedResponse, user?: SessionUser): Promise;
}
export declare class FileResult extends Content {
private filePath;
contentDisposition: "inline" | "attachment";
maxAge: number;
etag: boolean;
immutable: boolean;
protected lastModified: boolean;
fileName: any;
constructor(filePath: string, { contentDisposition, maxAge, etag, immutable, fileName, headers, contentType }?: Partial);
send(res: WrappedResponse): Promise;
}
export declare class TempFileResult extends FileResult {
constructor(file: LocalFile, p?: Partial);
}
export declare class Redirect extends Content {
location: string;
constructor(location: string, status?: number, headers?: OutgoingHttpHeaders);
send(res: WrappedResponse): Promise;
}
//# sourceMappingURL=Content.d.ts.map