@clickup/rest-client
Version:
A syntax sugar tool around Node fetch() API, tailored to work with TypeScript and response validators
24 lines • 998 B
TypeScript
/// <reference types="node" />
import type RestClient from "../RestClient";
/**
* Sends a series of Content-Range requests to an URL.
* - The stream size is unknown in advance even theoretically. So we read it
* with chunkSize+1 bytes chunks (+1 is to know for sure, is there something
* else left in the stream or not) and then send data with chunkSize bytes
* chunks.
* - The last chunk is a terminating one (and we know, which one is the last),
* so we reflect it in "Content-Range: x-y/S" format setting S to the total
* number of bytes in the stream.
*/
export default class RestRangeUploader {
private _client;
private _chunkSize;
private _method;
private _path;
private _mimeType;
private _pos;
constructor(_client: RestClient, _chunkSize: number, _method: "POST" | "PUT", _path: string, _mimeType: string);
upload(stream: AsyncIterable<Buffer>): Promise<string | null>;
private _flush;
}
//# sourceMappingURL=RestRangeUploader.d.ts.map