UNPKG

1.08 kBTypeScriptView Raw
1import { Readable } from 'stream';
2import { StreamableFileOptions, StreamableHandlerResponse } from './interfaces';
3import { Logger } from '../services';
4/**
5 * @see [Streaming files](https://docs.nestjs.com/techniques/streaming-files)
6 *
7 * @publicApi
8 */
9export declare class StreamableFile {
10 readonly options: StreamableFileOptions;
11 private readonly stream;
12 protected logger: Logger;
13 protected handleError: (err: Error, response: StreamableHandlerResponse) => void;
14 protected logError: (err: Error) => void;
15 constructor(buffer: Uint8Array, options?: StreamableFileOptions);
16 constructor(readable: Readable, options?: StreamableFileOptions);
17 getStream(): Readable;
18 getHeaders(): {
19 type: string;
20 disposition: string;
21 length: number;
22 };
23 get errorHandler(): (err: Error, response: StreamableHandlerResponse) => void;
24 setErrorHandler(handler: (err: Error, response: StreamableHandlerResponse) => void): this;
25 get errorLogger(): (err: Error) => void;
26 setErrorLogger(handler: (err: Error) => void): this;
27}