@structium/csv - API documentation β
Functions β
deserialize() β
ts
function deserialize<Res>(input: string, options?: Options<Res>): Promise<Res[]>Deserialize a CSV string into an object.
Type Parameters β
| Type Parameter | Description |
|---|---|
Res extends string[] | The expected return type of the deserialized object |
Parameters β
| Parameter | Type | Description |
|---|---|---|
input | string | The CSV content |
options? | Options<Res> | Options to pass to fast-csv |
Returns β
Promise<Res[]>
- A promise that resolves to the deserialized object
serialize() β
ts
function serialize<I>(input: I, options?: Options): Promise<string>Serialize an object or array of objects into a CSV string.
Type Parameters β
| Type Parameter | Description |
|---|---|
I extends CommonCSV | The type of the object(s) to serialize |
Parameters β
| Parameter | Type | Description |
|---|---|---|
input | I | The object or array of objects to serialize |
options? | Options | Options to pass to fast-csv |
Returns β
Promise<string>
- A promise that resolves to the CSV string
