You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realized that it was because one of the entries has a double quote RU.45.517838 Novotor”yal’skiy Rayon Novotor"yal'skiy Rayon 517838
, which if I delete it works properly RU.45.517838 Novotor[DELETED]yal’skiy Rayon Novotor"yal'skiy Rayon 517838
import{Writable}from"node:stream";importcsvParserfrom"csv-parser";import{Transform}from"stream";importhttpsfrom"https";constrepro=async()=>{letlineCount=0returnnewPromise<void>((resolve,reject)=>{https.get("https://download.geonames.org/export/dump/admin2Codes.txt",(response)=>{response.pipe(csvParser({separator: "\t",headers: ["id","name","nameAscii","geonameId"]})).pipe(newTransform({objectMode: true,transform(chunk,encoding,callback){lineCount++this.push(chunk);callback();},})).pipe(newWritable({objectMode: true,write(chunk,encoding,callback){callback();}})).on('finish',()=>{console.log("total lines should be ~45k",lineCount)resolve()}).on('error',reject)}).on('error',reject)})}(async()=>{awaitrepro()})()
The text was updated successfully, but these errors were encountered:
Expected Behavior
parse a file even if data has a double quote, or at least produce error
Actual Behavior
silently quits file early
How Do We Reproduce?
I kept getting less rows streamed than I expected from a file located at https://download.geonames.org/export/dump/admin2Codes.txt
This is a tab delimited file of 45,784 rows
I realized that it was because one of the entries has a double quote
RU.45.517838 Novotor”yal’skiy Rayon Novotor"yal'skiy Rayon 517838
, which if I delete it works properly
RU.45.517838 Novotor[DELETED]yal’skiy Rayon Novotor"yal'skiy Rayon 517838
The text was updated successfully, but these errors were encountered: