@btfuse/core
Version:
A native-first framework for building hybdrid web-native applications
29 lines (28 loc) • 842 B
TypeScript
/**
* A static class with convenience methods for reading common
* response content body formats.
*/
export declare class FuseResponseReader {
private constructor();
/**
* @remarks
* Reads the data buffer as a string
*
* @param data - input data
* @returns The buffer contents as a string
*/
static readAsText(data: ArrayBuffer): Promise<string>;
/**
* @remarks
* Reads the given data buffer as a JSON object. The JSON object
* can be typed as T generic. No validations occurs on whether the given
* data is actually a type of T.
*
* @throws {@link SyntaxError}
* If data is not parseable as JSON.
*
* @param data - input data
* @returns The buffer contents as a JSON object.
*/
static readAsJSON<T>(data: ArrayBuffer): Promise<T>;
}