@push.rocks/smartrequest
Version:
A module for modern HTTP/HTTPS requests with support for form data, file uploads, JSON, binary data, streams, and more.
21 lines (20 loc) • 722 B
TypeScript
export interface IMultipartFormDataAppendOptions {
filename: string;
contentType?: string;
}
/**
* Minimal multipart/form-data encoder for the values accepted by SmartRequest.
*/
export declare class MultipartFormData {
private readonly boundary;
private readonly parts;
constructor(boundary?: string);
append(name: string, value: string | Uint8Array, options?: IMultipartFormDataAppendOptions): void;
resolveMissingContentTypes(resolver: (filename: string) => string | null): void;
getHeaders(): Record<string, string>;
getContentLength(): number;
toArrayBuffer(): ArrayBuffer;
getChunks(): Iterable<Uint8Array>;
private getPartHeader;
private validateContentType;
}