stack

Home > @infiniteobjects/core-library-node > FileSystem > writeCsv

FileSystem.writeCsv() method

Stringify and write CSV to a file atomically, replacing the file if it already exists.

Signature:

static writeCsv<T = ObjectLike>(filepath: string, data: T[]): Promise<void>;

Parameters

Parameter Type Description
filepath string  
data T[]  

Returns:

Promise<void>

Remarks

Creates directories for you as needed and casts complex objects in dot notation

Example

Dot notation headers

[{name: 'foo', field: { nest: "bar"}}] => 'name,field.nest'