UNPKG

1.1 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Readable } from "stream";
3import { FileObject, SliceType } from "../../LargeFileUploadTask";
4import { Range } from "../Range";
5/**
6 * @class
7 * FileObject class for Readable Stream upload
8 */
9export declare class StreamUpload implements FileObject<Readable> {
10 content: Readable;
11 name: string;
12 size: number;
13 /**
14 * @private
15 * Represents a cache of the last attempted upload slice.
16 * This can be used when resuming a previously failed slice upload.
17 */
18 private previousSlice;
19 constructor(content: Readable, name: string, size: number);
20 /**
21 * @public
22 * Slices the file content to the given range
23 * @param {Range} range - The range value
24 * @returns The sliced file part
25 */
26 sliceFile(range: Range): Promise<SliceType>;
27 /**
28 * @private
29 * Reads the specified byte size from the stream
30 * @param {number} size - The size of bytes to be read
31 * @returns Buffer with the given length of data.
32 */
33 private readNBytesFromStream;
34}