UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

23 lines 1.04 kB
/** * Performs a `fetch` request using any provided arguments and returns a Promise * that resolves with the raw text response. * * This function is a wrapper around `fetch`, automatically extracting the response body * as plain text. It handles both network errors and issues during text parsing. * * @function getTextFetch * @param {...any} arguments - All arguments are forwarded directly to the `fetch` function. * Typically used as `getTextFetch(url, options)`. * * @returns {Promise<string>} A Promise that resolves with the response text * if the request is successful and parsing succeeds, * or rejects with an error if the request or text conversion fails. * @deprecated * * @example * getTextFetch('https://example.com/page') * .then(text => console.log(text)) * .catch(err => console.error('Fetch error:', err)); */ export default function getTextFetch(...args: any[]): Promise<string>; //# sourceMappingURL=text.d.mts.map