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
Copy file name to clipboardExpand all lines: src/csv.ts
+14-21Lines changed: 14 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ export async function csvDataFrame({
95
95
// Fetch the first chunk (stop at 80% of the chunk size, to avoid doing another fetch, as we have no way to limit to one chunk in Papaparse)
96
96
// TODO(SL): should we return the dataframe after parsing one row, and then keep parsing the chunk, but triggering updates?)
97
97
constfirstParsedRange: ParsedRange={
98
-
start: cursor,
98
+
start: 0,
99
99
end: cursor,
100
100
validRows: [],
101
101
};
@@ -108,30 +108,30 @@ export async function csvDataFrame({
108
108
skipEmptyLines: false,// to be able to compute the byte ranges. Beware, it requires post processing (see result.rows.at(-1), for example, when fetching all the rows)
109
109
dynamicTyping: false,// keep strings, and let the user convert them if needed
110
110
step: ({ data, meta },parser)=>{
111
-
conststart=cursor;
112
-
cursor=meta.cursor;
113
-
constend=cursor;
111
+
constparsedRow={
112
+
start: cursor,
113
+
end: meta.cursor,
114
+
data,
115
+
};
116
+
cursor=parsedRow.end;
117
+
114
118
if(
115
-
cursor>=0.8*chunkSize||
119
+
cursor>=0.8*chunkSize||// stop at 80% of the chunk size, to avoid doing another fetch, as we have no way to limit to one chunk in Papaparse
0 commit comments