Created
October 9, 2021 12:29
-
-
Save johnniehard/d77201fb474cd8bdd6d1dadb0fc9ffb5 to your computer and use it in GitHub Desktop.
Async wrapper for csv-parse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import parse, { Options } from "csv-parse"; | |
export function parseAsync(csv: string, options: Options) { | |
return new Promise<any[]>((resolve, reject) => { | |
parse(csv, options, (err, output) => { | |
if (err) { | |
return reject(err) | |
} | |
resolve(output) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment