Function: fetchCsv()
fetchCsv<
T
>(url
,schema
,fetchRequestInit
?):Promise
<StaticDecode
<T
>[]>
Fetch CSV from the URL and parse according to the given schema
Type Parameters
Type Parameter |
---|
T extends TCsvSchema |
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL to the CSV file |
schema | T | Output schema mapping of each row |
fetchRequestInit ? | FetchRequestInit | Options for fetch() request FetchRequestInit |
Returns
Promise
<StaticDecode
<T
>[]>
An array of objects corresponded to the table definition
Throws
If fail to fetch or parse the schema
Example
ts
const output = await fetchCsv('https://url-to/data.csv', schema);