@konstit/csv 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +554 -0
  3. package/THIRD_PARTY_NOTICES.md +365 -0
  4. package/dist/api.d.ts +81 -0
  5. package/dist/api.js +515 -0
  6. package/dist/batches.d.ts +47 -0
  7. package/dist/batches.js +348 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.js +605 -0
  10. package/dist/file-stream.d.ts +11 -0
  11. package/dist/file-stream.js +290 -0
  12. package/dist/files.d.ts +8 -0
  13. package/dist/files.js +150 -0
  14. package/dist/filter.d.ts +8 -0
  15. package/dist/filter.js +82 -0
  16. package/dist/index.d.ts +6 -0
  17. package/dist/index.js +19 -0
  18. package/dist/native.d.ts +199 -0
  19. package/dist/native.js +275 -0
  20. package/dist/normalize.d.ts +56 -0
  21. package/dist/normalize.js +365 -0
  22. package/dist/options.d.ts +17 -0
  23. package/dist/options.js +12 -0
  24. package/dist/parser.d.ts +32 -0
  25. package/dist/parser.js +254 -0
  26. package/dist/runtime.d.ts +5 -0
  27. package/dist/runtime.js +12 -0
  28. package/dist/strict-schema.d.ts +12 -0
  29. package/dist/strict-schema.js +90 -0
  30. package/dist/types.d.ts +181 -0
  31. package/dist/types.js +0 -0
  32. package/dist/worker-count.d.ts +2 -0
  33. package/dist/worker-count.js +96 -0
  34. package/dist/worker-factory.d.ts +3 -0
  35. package/dist/worker-factory.js +9 -0
  36. package/dist/worker-filter.d.ts +29 -0
  37. package/dist/worker-filter.js +46 -0
  38. package/dist/worker-module.d.ts +1 -0
  39. package/dist/worker-module.js +4 -0
  40. package/dist/worker-pool.d.ts +17 -0
  41. package/dist/worker-pool.js +290 -0
  42. package/dist/worker-rows.d.ts +8 -0
  43. package/dist/worker-rows.js +118 -0
  44. package/dist/workers/count.worker.d.ts +1 -0
  45. package/dist/workers/count.worker.js +49 -0
  46. package/dist/workers/rows.worker.d.ts +1 -0
  47. package/dist/workers/rows.worker.js +85 -0
  48. package/dist/zip-reader.d.ts +2 -0
  49. package/dist/zip-reader.js +89 -0
  50. package/package.json +122 -0
  51. package/prebuilds/darwin-arm64/libcsv_native.dylib +0 -0
  52. package/prebuilds/darwin-x64/libcsv_native.dylib +0 -0
  53. package/prebuilds/linux-x64/libcsv_native.so +0 -0
  54. package/prebuilds/manifest.json +48 -0
  55. package/prebuilds/provenance/darwin-arm64.json +1 -0
  56. package/prebuilds/provenance/darwin-x64.json +1 -0
  57. package/prebuilds/provenance/linux-x64.json +1 -0
package/dist/api.js ADDED
@@ -0,0 +1,515 @@
1
+ import { NativeCsvRowView } from "./batches.js";
2
+ import {
3
+ prepareCsvFileInput,
4
+ rejectAutoDelimiterSharding,
5
+ rejectCompressedSharding
6
+ } from "./file-stream.js";
7
+ import {
8
+ findCsvSafeShards as findCsvSafeShardsNative,
9
+ findCsvSafeSplitOffsets as findCsvSafeSplitOffsetsNative
10
+ } from "./files.js";
11
+ import {
12
+ all,
13
+ any,
14
+ column,
15
+ nativeFilterProgramFor,
16
+ not,
17
+ re
18
+ } from "./filter.js";
19
+ import { normalizeColumns } from "./normalize.js";
20
+ import { NativeCsvParser } from "./parser.js";
21
+ import {
22
+ rejectStrictSchemaUnsupported,
23
+ strictSchemaValidator
24
+ } from "./strict-schema.js";
25
+ import { parallelCount } from "./worker-count.js";
26
+ import {
27
+ createWorkerPool,
28
+ CsvWorkerPool
29
+ } from "./worker-pool.js";
30
+ import { parallelRows } from "./worker-rows.js";
31
+ export async function parse(buffer, options = {}) {
32
+ if ("compression" in options && options.compression !== void 0)
33
+ throw Error("parse() does not support compression; pass decompressed bytes or use a file API");
34
+ if (options.delimiter === "auto")
35
+ throw Error("parse() does not support automatic delimiter detection; specify delimiter or use a file API");
36
+ rejectFilteredStrictSchema(options);
37
+ const filters = toNativeFilters(options.where);
38
+ const parser = new NativeCsvParser(toParserOptions(options));
39
+ const validator = strictSchemaValidator(options);
40
+ try {
41
+ const batch = writeMaterializeBatch(parser, buffer, options, filters, !0);
42
+ try {
43
+ validator?.validateBatch(batch);
44
+ validator?.finish();
45
+ return materializeRows(batch, options);
46
+ } finally {
47
+ batch.close();
48
+ }
49
+ } finally {
50
+ parser.close();
51
+ }
52
+ }
53
+ export async function* rows(path, options = {}) {
54
+ if ((options.workerCount ?? 1) > 1) {
55
+ rejectCompressedSharding(options, "parallel row parsing");
56
+ rejectAutoDelimiterSharding(options, "parallel row parsing");
57
+ yield* parallelRows(path, options);
58
+ return;
59
+ }
60
+ rejectFilteredStrictSchema(options);
61
+ const filters = toNativeFilters(options.where);
62
+ await using input = await prepareCsvFileInput(path, options);
63
+ using parser = new NativeCsvParser(toParserOptions(options, input.delimiter));
64
+ const validator = strictSchemaValidator(options);
65
+ for await (const chunk of input.chunks()) {
66
+ const batch = writeMaterializeBatch(parser, chunk, options, filters);
67
+ if (batch.rowCount > 0)
68
+ try {
69
+ validator?.validateBatch(batch);
70
+ const values = materializeRows(batch, options);
71
+ if (values.length > 0)
72
+ yield values;
73
+ } finally {
74
+ batch.close();
75
+ }
76
+ else
77
+ batch.close();
78
+ }
79
+ const batch = finishMaterializeBatch(parser, options, filters);
80
+ if (batch.rowCount > 0)
81
+ try {
82
+ validator?.validateBatch(batch);
83
+ validator?.finish();
84
+ const values = materializeRows(batch, options);
85
+ if (values.length > 0)
86
+ yield values;
87
+ } finally {
88
+ batch.close();
89
+ }
90
+ else {
91
+ validator?.finish();
92
+ batch.close();
93
+ }
94
+ }
95
+
96
+ export { parallelRows };
97
+ export { CsvWorkerPool };
98
+ export async function* batches(path, options = {}) {
99
+ rejectFilteredStrictSchema(options);
100
+ const filters = toNativeFilters(options.where);
101
+ await using input = await prepareCsvFileInput(path, options);
102
+ using parser = new NativeCsvParser(toParserOptions(options, input.delimiter));
103
+ const validator = strictSchemaValidator(options);
104
+ for await (const chunk of input.chunks()) {
105
+ const batch = writeRowsBatch(parser, chunk, options, filters);
106
+ if (batch.rowCount > 0) {
107
+ try {
108
+ validator?.validateBatch(batch);
109
+ } catch (error) {
110
+ batch.close();
111
+ throw error;
112
+ }
113
+ yield batch;
114
+ } else
115
+ batch.close();
116
+ }
117
+ const batch = finishRowsBatch(parser, options, filters);
118
+ if (batch.rowCount > 0) {
119
+ try {
120
+ validator?.validateBatch(batch);
121
+ validator?.finish();
122
+ } catch (error) {
123
+ batch.close();
124
+ throw error;
125
+ }
126
+ yield batch;
127
+ } else {
128
+ validator?.finish();
129
+ batch.close();
130
+ }
131
+ }
132
+ export async function withBatches(path, options, callback) {
133
+ for await (const batch of batches(path, options))
134
+ try {
135
+ await callback(batch);
136
+ } finally {
137
+ batch.close();
138
+ }
139
+ }
140
+ export async function forEachColumnarBatches(path, options = {}, callback) {
141
+ ensureColumnarBatchesSupported(options);
142
+ const filters = toNativeFilters(options.where);
143
+ const scopedBatch = new ScopedCsvColumnarBatchView(selectedColumns(options));
144
+ let batchIndex = 0;
145
+ await using input = await prepareCsvFileInput(path, options);
146
+ using parser = new NativeCsvParser(toParserOptions(options, input.delimiter));
147
+ const validator = strictSchemaValidator(options);
148
+ for await (const chunk of input.chunks()) {
149
+ const batch = writeColumnarBatch(parser, chunk, options, filters);
150
+ if (batch.rowCount > 0)
151
+ try {
152
+ validator?.validateBatch(batch);
153
+ scopedBatch.bind(batch);
154
+ try {
155
+ const result = callback(scopedBatch, batchIndex);
156
+ if (isPromiseLike(result))
157
+ throw TypeError("columnar batch callback must be synchronous");
158
+ } finally {
159
+ scopedBatch.release();
160
+ }
161
+ ++batchIndex;
162
+ } finally {
163
+ batch.close();
164
+ }
165
+ else
166
+ batch.close();
167
+ }
168
+ const batch = finishColumnarBatch(parser, options, filters);
169
+ if (batch.rowCount > 0)
170
+ try {
171
+ validator?.validateBatch(batch);
172
+ validator?.finish();
173
+ scopedBatch.bind(batch);
174
+ try {
175
+ const result = callback(scopedBatch, batchIndex);
176
+ if (isPromiseLike(result))
177
+ throw TypeError("columnar batch callback must be synchronous");
178
+ } finally {
179
+ scopedBatch.release();
180
+ }
181
+ } finally {
182
+ batch.close();
183
+ }
184
+ else {
185
+ validator?.finish();
186
+ batch.close();
187
+ }
188
+ }
189
+ export function withColumnarBatches(path, options, callback) {
190
+ return forEachColumnarBatches(path, options, callback);
191
+ }
192
+ export async function forEachRowViews(path, options = {}, callback) {
193
+ ensureRowViewsSupported(options);
194
+ const scopedRowView = new ScopedCsvRowView(selectedColumns(options));
195
+ for await (const batch of batches(path, options))
196
+ try {
197
+ const rowCount = batch.rowCount;
198
+ if (rowCount === 0)
199
+ continue;
200
+ const reusable = new NativeCsvRowView(batch.data(), batch.rowOffsets(), batch.fieldOffsets());
201
+ for (let rowIndex = 0;rowIndex < rowCount; ++rowIndex) {
202
+ scopedRowView.bind(reusable.moveTo(rowIndex));
203
+ try {
204
+ const result = callback(scopedRowView, rowIndex);
205
+ if (isPromiseLike(result))
206
+ throw TypeError("row view callback must be synchronous");
207
+ } finally {
208
+ scopedRowView.release();
209
+ }
210
+ }
211
+ } finally {
212
+ batch.close();
213
+ }
214
+ }
215
+ export function withRowViews(path, options, callback) {
216
+ return forEachRowViews(path, options, callback);
217
+ }
218
+ export async function count(path, options = {}) {
219
+ if ((options.workerCount ?? 1) > 1) {
220
+ rejectCompressedSharding(options, "parallel counting");
221
+ rejectAutoDelimiterSharding(options, "parallel counting");
222
+ return parallelCount(path, options);
223
+ }
224
+ const filters = toNativeFilters(options.where);
225
+ await using input = await prepareCsvFileInput(path, options);
226
+ using parser = new NativeCsvParser(toParserOptions(options, input.delimiter));
227
+ const validator = strictSchemaValidator(options);
228
+ let total = 0;
229
+ if (options.strict === !0 && filters === void 0) {
230
+ for await (const chunk of input.chunks()) {
231
+ const batch = parser.writeBatch(chunk);
232
+ try {
233
+ validator?.validateBatch(batch);
234
+ total += batch.rowCount;
235
+ } finally {
236
+ batch.close();
237
+ }
238
+ }
239
+ const batch = parser.endBatch();
240
+ try {
241
+ validator?.validateBatch(batch);
242
+ validator?.finish();
243
+ total += batch.rowCount;
244
+ } finally {
245
+ batch.close();
246
+ }
247
+ return total;
248
+ }
249
+ for await (const chunk of input.chunks())
250
+ total += writeCount(parser, chunk, filters);
251
+ total += finishCount(parser, filters);
252
+ return total;
253
+ }
254
+
255
+ export { parallelCount };
256
+ export function findCsvSafeSplitOffsets(path, shardCount, options = {}) {
257
+ rejectCompressedSharding(options, "CSV split offset scanning");
258
+ rejectAutoDelimiterSharding(options, "CSV split offset scanning");
259
+ return findCsvSafeSplitOffsetsNative(path, shardCount, options.delimiter ?? ",");
260
+ }
261
+ export function findCsvSafeShards(path, shardCount, options = {}) {
262
+ rejectCompressedSharding(options, "CSV shard scanning");
263
+ rejectAutoDelimiterSharding(options, "CSV shard scanning");
264
+ return findCsvSafeShardsNative(path, shardCount, options.delimiter ?? ",");
265
+ }
266
+ export function workerPool(path, options) {
267
+ return createWorkerPool(path, options);
268
+ }
269
+ export const csv = {
270
+ all,
271
+ any,
272
+ column,
273
+ not,
274
+ re,
275
+ workerPool,
276
+ parse,
277
+ rows,
278
+ parallelCount,
279
+ parallelRows,
280
+ batches,
281
+ withBatches,
282
+ forEachColumnarBatches,
283
+ withColumnarBatches,
284
+ forEachRowViews,
285
+ withRowViews,
286
+ count,
287
+ findCsvSafeSplitOffsets,
288
+ findCsvSafeShards
289
+ };
290
+ function toParserOptions(options, delimiter = options.delimiter) {
291
+ const selectedColumns = "columns" in options && options.columns !== void 0 ? options.columns : options.selectedColumns;
292
+ if ("columns" in options && options.columns !== void 0 && options.selectedColumns !== void 0)
293
+ throw Error("use columns or selectedColumns, not both");
294
+ return {
295
+ delimiter,
296
+ encoding: options.encoding,
297
+ strict: options.strict,
298
+ selectedColumns,
299
+ fixedColumns: options.fixedColumns
300
+ };
301
+ }
302
+ function selectedColumns(options) {
303
+ if (options.columns !== void 0 && options.selectedColumns !== void 0)
304
+ throw Error("use columns or selectedColumns, not both");
305
+ const columns = options.columns ?? options.selectedColumns;
306
+ normalizeColumns(columns);
307
+ return columns;
308
+ }
309
+ function materializeRows(batch, options) {
310
+ const columns = selectedColumns(options);
311
+ if (usesProjectedMaterialization(options))
312
+ return batch.rowsInto([]);
313
+ return batch.rowsInto([], columns);
314
+ }
315
+ function usesProjectedMaterialization(options) {
316
+ return options.where !== void 0 || options.strict !== !0 && selectedColumns(options) !== void 0;
317
+ }
318
+ function writeRowsBatch(parser, chunk, options, filters, final = !1) {
319
+ if (filters !== void 0)
320
+ return parser.writeProjectedBatchWhere(chunk, selectedColumns(options), filters, final);
321
+ return parser.writeBatch(chunk, final);
322
+ }
323
+ function writeMaterializeBatch(parser, chunk, options, filters, final = !1) {
324
+ const columns = selectedColumns(options);
325
+ if (filters !== void 0)
326
+ return parser.writeProjectedBatchWhere(chunk, columns, filters, final);
327
+ if (options.strict !== !0 && columns !== void 0)
328
+ return parser.writeProjectedBatch(chunk, { selectedColumns: columns }, final);
329
+ return parser.writeBatch(chunk, final);
330
+ }
331
+ function writeColumnarBatch(parser, chunk, options, filters, final = !1) {
332
+ const columns = selectedColumns(options);
333
+ if (filters !== void 0)
334
+ return parser.writeProjectedBatchWhere(chunk, columns, filters, final);
335
+ if (columns !== void 0)
336
+ return parser.writeProjectedBatch(chunk, { selectedColumns: columns }, final);
337
+ return parser.writeBatch(chunk, final);
338
+ }
339
+ function finishRowsBatch(parser, options, filters) {
340
+ if (filters !== void 0)
341
+ return parser.endProjectedBatchWhere(selectedColumns(options), filters);
342
+ return parser.endBatch();
343
+ }
344
+ function finishMaterializeBatch(parser, options, filters) {
345
+ const columns = selectedColumns(options);
346
+ if (filters !== void 0)
347
+ return parser.endProjectedBatchWhere(columns, filters);
348
+ if (options.strict !== !0 && columns !== void 0)
349
+ return parser.endProjectedBatch({ selectedColumns: columns });
350
+ return parser.endBatch();
351
+ }
352
+ function finishColumnarBatch(parser, options, filters) {
353
+ const columns = selectedColumns(options);
354
+ if (filters !== void 0)
355
+ return parser.endProjectedBatchWhere(columns, filters);
356
+ if (columns !== void 0)
357
+ return parser.endProjectedBatch({ selectedColumns: columns });
358
+ return parser.endBatch();
359
+ }
360
+ function ensureRowViewsSupported(options) {
361
+ if ((options.workerCount ?? 1) > 1)
362
+ throw Error("row view callbacks do not support workerCount; use rows()/parallelRows() for materialized rows or withBatches() for low-level streaming");
363
+ }
364
+ function ensureColumnarBatchesSupported(options) {
365
+ ensureRowViewsSupported(options);
366
+ if (options.strict === !0 && selectedColumns(options) !== void 0)
367
+ throw Error("columnar batch callbacks do not support strict selectedColumns; use rows() for projected validation or withBatches() for manual low-level handling");
368
+ }
369
+ function rejectFilteredStrictSchema(options) {
370
+ if (options.where !== void 0)
371
+ rejectStrictSchemaUnsupported(options, "filtered rows");
372
+ }
373
+ function isPromiseLike(value) {
374
+ return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
375
+ }
376
+
377
+ class ScopedCsvRowView {
378
+ #selectedColumns;
379
+ #rowView = null;
380
+ constructor(selectedColumns) {
381
+ this.#selectedColumns = selectedColumns;
382
+ }
383
+ bind(rowView) {
384
+ this.#rowView = rowView;
385
+ return this;
386
+ }
387
+ release() {
388
+ this.#rowView = null;
389
+ }
390
+ get rowIndex() {
391
+ return this.#requireRowView().rowIndex;
392
+ }
393
+ get fieldCount() {
394
+ return this.#requireRowView().fieldCount;
395
+ }
396
+ get selectedColumns() {
397
+ return this.#selectedColumns;
398
+ }
399
+ fieldRange(columnIndex) {
400
+ return this.#requireRowView().fieldRange(columnIndex);
401
+ }
402
+ range(columnIndex) {
403
+ return this.#requireRowView().range(columnIndex);
404
+ }
405
+ fieldBytes(columnIndex) {
406
+ return this.#requireRowView().fieldBytes(columnIndex);
407
+ }
408
+ bytes(columnIndex) {
409
+ return this.#requireRowView().bytes(columnIndex);
410
+ }
411
+ fieldBuffer(columnIndex) {
412
+ return this.#requireRowView().fieldBuffer(columnIndex);
413
+ }
414
+ buffer(columnIndex) {
415
+ return this.#requireRowView().buffer(columnIndex);
416
+ }
417
+ fieldString(columnIndex) {
418
+ return this.#requireRowView().fieldString(columnIndex);
419
+ }
420
+ getPhysical(columnIndex) {
421
+ return this.#requireRowView().getPhysical(columnIndex);
422
+ }
423
+ get(columnIndex) {
424
+ return this.#requireRowView().get(columnIndex);
425
+ }
426
+ pickPhysical(columns) {
427
+ return this.#requireRowView().pickPhysical(columns);
428
+ }
429
+ pick(columns) {
430
+ return this.#requireRowView().pick(columns);
431
+ }
432
+ #requireRowView() {
433
+ if (this.#rowView === null)
434
+ throw Error("row view is only valid during row view callback");
435
+ return this.#rowView;
436
+ }
437
+ }
438
+
439
+ class ScopedCsvColumnarBatchView {
440
+ #selectedColumns;
441
+ #batch = null;
442
+ constructor(selectedColumns) {
443
+ this.#selectedColumns = selectedColumns;
444
+ }
445
+ bind(batch) {
446
+ this.#batch = batch;
447
+ return this;
448
+ }
449
+ release() {
450
+ this.#batch = null;
451
+ }
452
+ get rowCount() {
453
+ return this.#requireBatch().rowCount;
454
+ }
455
+ get totalFields() {
456
+ return this.#requireBatch().totalFields;
457
+ }
458
+ get dataLength() {
459
+ return this.#requireBatch().dataLength;
460
+ }
461
+ get selectedColumns() {
462
+ return this.#selectedColumns;
463
+ }
464
+ data() {
465
+ return this.#requireBatch().data();
466
+ }
467
+ dataView() {
468
+ return this.#requireBatch().dataView();
469
+ }
470
+ rowOffsets() {
471
+ return this.#requireBatch().rowOffsets();
472
+ }
473
+ fieldOffsets() {
474
+ return this.#requireBatch().fieldOffsets();
475
+ }
476
+ rowFieldCount(rowIndex) {
477
+ return this.#requireBatch().rowFieldCount(rowIndex);
478
+ }
479
+ fieldRange(rowIndex, columnIndex) {
480
+ return this.#requireBatch().fieldRange(rowIndex, columnIndex);
481
+ }
482
+ fieldBytes(rowIndex, columnIndex) {
483
+ return this.#requireBatch().fieldBytes(rowIndex, columnIndex);
484
+ }
485
+ fieldBuffer(rowIndex, columnIndex) {
486
+ return this.#requireBatch().fieldBuffer(rowIndex, columnIndex);
487
+ }
488
+ forEachColumnRange(columnIndex, callback, startRow, endRow) {
489
+ return this.#requireBatch().forEachColumnRange(columnIndex, callback, startRow, endRow);
490
+ }
491
+ forEachColumnBytes(columnIndex, callback, startRow, endRow) {
492
+ return this.#requireBatch().forEachColumnBytes(columnIndex, callback, startRow, endRow);
493
+ }
494
+ scanColumns(columns, callback, startRow, endRow) {
495
+ return this.#requireBatch().scanColumns(columns, callback, startRow, endRow);
496
+ }
497
+ #requireBatch() {
498
+ if (this.#batch === null)
499
+ throw Error("columnar batch view is only valid during columnar batch callback");
500
+ return this.#batch;
501
+ }
502
+ }
503
+ function writeCount(parser, chunk, filters) {
504
+ if (filters === void 0)
505
+ return parser.writeCount(chunk);
506
+ return parser.writeCountWhere(chunk, filters);
507
+ }
508
+ function finishCount(parser, filters) {
509
+ if (filters === void 0)
510
+ return parser.endCount();
511
+ return parser.endCountWhere(filters);
512
+ }
513
+ function toNativeFilters(where) {
514
+ return nativeFilterProgramFor(where);
515
+ }
@@ -0,0 +1,47 @@
1
+ import { type NativePointer } from './native.js';
2
+ import type { CsvColumnBytesCallback, CsvColumnRangeCallback, CsvColumns, CsvFieldRange, CsvRow, CsvScanColumnsCallback, NativeCsvRowCallback } from './types.js';
3
+ export declare class NativeCsvRowView {
4
+ #private;
5
+ constructor(data: Buffer, rowOffsets: BigUint64Array, fieldOffsets: BigUint64Array, rowIndex?: number);
6
+ get rowIndex(): number;
7
+ get fieldCount(): number;
8
+ moveTo(rowIndex: number): this;
9
+ fieldRange(columnIndex: number): CsvFieldRange | null;
10
+ range(columnIndex: number): CsvFieldRange | null;
11
+ fieldBytes(columnIndex: number): Uint8Array | null;
12
+ bytes(columnIndex: number): Uint8Array | null;
13
+ fieldBuffer(columnIndex: number): Buffer | null;
14
+ buffer(columnIndex: number): Buffer | null;
15
+ fieldString(columnIndex: number): string | null;
16
+ getPhysical(columnIndex: number): string | null;
17
+ get(columnIndex: number): string | null;
18
+ pickPhysical(columns: CsvColumns): string[];
19
+ pick(columns: CsvColumns): string[];
20
+ }
21
+ export declare class NativeCsvBatch {
22
+ #private;
23
+ constructor(handle: NativePointer);
24
+ get closed(): boolean;
25
+ get rowCount(): number;
26
+ get totalFields(): number;
27
+ get dataLength(): number;
28
+ rows(): CsvRow[];
29
+ forEachRow(callback: NativeCsvRowCallback): void;
30
+ rowsInto(target: CsvRow[], columns?: CsvColumns): CsvRow[];
31
+ data(): Buffer;
32
+ dataView(): Uint8Array;
33
+ rowOffsets(): BigUint64Array;
34
+ fieldOffsets(): BigUint64Array;
35
+ rowFieldCount(rowIndex: number): number;
36
+ fieldRange(rowIndex: number, columnIndex: number): CsvFieldRange | null;
37
+ fieldBuffer(rowIndex: number, columnIndex: number): Buffer | null;
38
+ fieldBytes(rowIndex: number, columnIndex: number): Uint8Array | null;
39
+ fieldString(rowIndex: number, columnIndex: number): string | null;
40
+ forEachColumnRange(columnIndex: number, callback: CsvColumnRangeCallback, startRow?: number, endRow?: number): void;
41
+ forEachColumnBytes(columnIndex: number, callback: CsvColumnBytesCallback, startRow?: number, endRow?: number): void;
42
+ scanColumns(columns: CsvColumns, callback: CsvScanColumnsCallback, startRow?: number, endRow?: number): void;
43
+ countWhereEquals(columnIndex: number, value: string | Buffer | Uint8Array): number;
44
+ close(): void;
45
+ dispose(): void;
46
+ [Symbol.dispose](): void;
47
+ }