Split the code, add file server example.

This commit is contained in:
SukantGujar
2019-03-11 13:41:55 +05:30
parent 45439ef50d
commit 2d2d20f6e9
16 changed files with 560 additions and 135 deletions

22
src/Content.ts Normal file
View File

@@ -0,0 +1,22 @@
import { Range } from "./parseRangeHeader";
import { Stream } from "stream";
export type Content = {
/**
* Returns a readable stream based on the provided range (optional).
* @param {Range} range The start-end range of stream data.
* @returns {Stream} A readable stream
*/
getStream(range?: Range): Stream;
/**
* Total size of the content
*/
readonly totalSize: number;
/**
* Mime type to be sent in Content-Type header
*/
readonly mimeType: string;
/**
* File name to be sent in Content-Disposition header
*/
readonly fileName: string;
};