Function: loadData()
Loads data.
Parameters
• url: string
The URL from which to load data.
• type?: "auto"
| "json"
| "csv"
| "tsv"
| "xml"
= 'auto'
The data type must be one of ['json', 'csv', 'tsv', 'xml']. Defaults to 'auto'.
Returns
Promise
<Data
[]> | Promise
<WideData
[]>
A promise that resolves to the loaded data.
Description
This function loads data from the given URL based on the detected data type. The data type can be explicitly specified or automatically detected from the URL extension. The supported data types are 'json', 'csv', 'tsv', and 'xml'.
Throws
Throws an error if the data type is unsupported or if data loading fails.
Example
loadData('data.csv', 'auto')
.then(data => console.log(data))
.catch(error => console.error(error));
See
https://racing-bars.hatemhosny.dev/documentation/api#loaddata