The sync API behave like a pure function. For a given input made of the input data set and its options, it always produce the same output data.
This represent a regular direct synchronous call to a function: you pass records and it return a CSV text. Because of its simplicity, this is the recommended approach if you don't need scalability and if your dataset fit in memory.
The module to import is
csv-stringify/sync and the signature is
const data = stringify(records, [options]) as shown in the sync example: