fix: race condition?

This commit is contained in:
orion 2024-05-02 13:06:08 -05:00
parent ee7619b93d
commit a7b46d632a
Signed by: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -10,9 +10,9 @@ class ParserWithColumns extends Parser {
/** @type {(s: import('csv-parse').Options) => () => ParserWithColumns} */
export const makeImpl = c => () => {
const parser = new ParserWithColumns(c)
while (parser.columns.length === 0) {
parser.columns = parser.read() || [];
}
parser.once('data', chunk => {
parser.columns = chunk;
})
return parser
}