export declare type TextEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex'; export interface FormDataChunk { /** * Name of the form data entry. Defaults to: `file`. */ name?: string; /** * Name of the file in form data entry, only necessary when uploading files. */ fileName?: string; /** * Array buffer to encode, only necessary when uploading files. */ value: ArrayBuffer | string; /** * Content type of the form data entry for file uploads. Defaults to: `application/octet-stream`. */ contentType?: string; } export interface BufferedFormData { /** * Randomized delimiter that was used for the form data boundary. */ readonly delimiter: string; /** * Boundary that was used to construct the form data. */ readonly boundary: string; /** * Encoded form data. */ readonly arrayBuffer: Uint8Array; /** * Content type for the form data that includes the boundary. */ readonly contentType: string; } /** * Converts text to buffer (Uint8Array). * * @param text Text to convert. * @param encoding Text encoding to convert from, optional, defaults to 'utf8'. */ export declare function convertTextToBuffer(text: string, encoding?: TextEncoding): Uint8Array; /** * Converts buffer (ArrayBuffer) to text. * * @param buffer Buffer to convert. * @param encoding Text encoding to convert to, optional, defaults to 'utf8'. */ export declare function convertBufferToText(buffer: ArrayBuffer, encoding?: TextEncoding): string; /** * Converts one text format to another. * * @param text Text to convert. * @param sourceEncoding Text encoding to convert from. * @param targetEncoding Text encoding to convert to, optional, defaults to 'utf8'. */ export declare function convertTextToText(text: string, sourceEncoding: TextEncoding, targetEncoding?: TextEncoding): string; /** * Converts text to base64 format. You can alternatively use 'btoa' function for this, but this function optionally allows to specify encoding. * * @param text Text to convert. * @param encoding Text encoding to convert from, optional, defaults to 'utf8'. */ export declare function convertTextToBase64(text: string, encoding?: TextEncoding): string; /** * Converts base64 format to text. You can alternative use 'atob' function for this, but this function optionally allows to specify encoding. * * @param base64 Base64 format to convert. * @param encoding Text encoding to convert to. */ export declare function convertBase64ToText(base64: string, encoding?: TextEncoding): string; /** * Converts base64 format to buffer (Uint8Array). * * @param base64 Base64 format to convert. */ export declare function convertBase64ToBuffer(base64: string): Uint8Array; /** * Converts buffer (ArrayBuffer) to base64 format. * * @param buffer Buffer to convert. */ export declare function convertBufferToBase64(buffer: ArrayBuffer): string; /** * Converts chunks of data into encoded form data. This is more efficient (consumes less memory and CPU) than building form data using `FormData` and `Blob`classes when uploading files. * @param chunks Chunks of data to encode * @returns Object that contains the encoded array buffer and content type. */ export declare function convertArrayBufferToFormDataBuffer(...chunks: FormDataChunk[]): BufferedFormData; export declare namespace Convert { /** * Converts text to buffer (Uint8Array). * * @param text Text to convert. * @param encoding Text encoding to convert from, optional, defaults to 'utf8'. */ function textToBuffer(text: string, encoding?: TextEncoding): Uint8Array; /** * Converts buffer (ArrayBuffer) to text. * * @param buffer Buffer to convert. * @param encoding Text encoding to convert to, optional, defaults to 'utf8'. */ function bufferToText(buffer: ArrayBuffer, encoding?: TextEncoding): string; /** * Converts one text format to another. * * @param text Text to convert. * @param sourceEncoding Text encoding to convert from. * @param targetEncoding Text encoding to convert to, optional, defaults to 'utf8'. */ function textToText(text: string, sourceEncoding: TextEncoding, targetEncoding?: TextEncoding): string; /** * Converts text to base64 format. You can alternatively use 'btoa' function for this, but this function optionally allows to specify encoding. * * @param text Text to convert. * @param encoding Text encoding to convert from, optional, defaults to 'utf8'. */ function textToBase64(text: string, encoding?: TextEncoding): string; /** * Converts base64 format to text. You can alternative use 'atob' function for this, but this function optionally allows to specify encoding. * * @param base64 Base64 format to convert. * @param encoding Text encoding to convert to. */ function base64ToText(base64: string, encoding?: TextEncoding): string; /** * Converts base64 format to buffer (Uint8Array). * * @param base64 Base64 format to convert. */ function base64ToBuffer(base64: string): Uint8Array; /** * Converts buffer (ArrayBuffer) to base64 format. * * @param buffer Buffer to convert. */ function bufferToBase64(buffer: ArrayBuffer): string; /** * Converts chunks of data into encoded form data. This is more efficient (consumes less memory and CPU) than building form data using `FormData` and `Blob`classes when uploading files. * @param chunks Chunks of data to encode * @returns Object that contains the encoded array buffer and content type. */ function arrayBufferToFormDataBuffer(...chunks: FormDataChunk[]): BufferedFormData; } //# sourceMappingURL=index.d.ts.map