@konstit/csv 0.4.1 → 0.4.3

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 (42) hide show
  1. package/README.md +136 -463
  2. package/dist/api.d.ts +356 -21
  3. package/dist/api.js +64 -93
  4. package/dist/batches.d.ts +291 -0
  5. package/dist/batches.js +72 -43
  6. package/dist/file-stream.d.ts +2 -2
  7. package/dist/file-stream.js +5 -2
  8. package/dist/files.d.ts +148 -2
  9. package/dist/files.js +30 -24
  10. package/dist/filter.d.ts +82 -0
  11. package/dist/latin1-rows.d.ts +3 -0
  12. package/dist/latin1-rows.js +84 -0
  13. package/dist/materialize-field.d.ts +1 -0
  14. package/dist/materialize-field.js +26 -0
  15. package/dist/native.d.ts +29 -0
  16. package/dist/native.js +44 -3
  17. package/dist/normalize.d.ts +18 -1
  18. package/dist/normalize.js +10 -0
  19. package/dist/options-snapshot.d.ts +3 -0
  20. package/dist/options-snapshot.js +50 -0
  21. package/dist/options.d.ts +44 -3
  22. package/dist/parser.d.ts +307 -1
  23. package/dist/parser.js +121 -8
  24. package/dist/strict-schema.d.ts +1 -1
  25. package/dist/strict-schema.js +4 -1
  26. package/dist/types.d.ts +435 -67
  27. package/dist/worker-count.d.ts +33 -1
  28. package/dist/worker-count.js +6 -1
  29. package/dist/worker-pool.d.ts +77 -1
  30. package/dist/worker-pool.js +11 -3
  31. package/dist/worker-rows.d.ts +31 -3
  32. package/dist/worker-rows.js +11 -2
  33. package/dist/workers/count.worker.js +13 -26
  34. package/dist/workers/rows.worker.js +23 -52
  35. package/package.json +23 -10
  36. package/prebuilds/darwin-arm64/libcsv_native.dylib +0 -0
  37. package/prebuilds/darwin-x64/libcsv_native.dylib +0 -0
  38. package/prebuilds/linux-x64/libcsv_native.so +0 -0
  39. package/prebuilds/manifest.json +8 -8
  40. package/prebuilds/provenance/darwin-arm64.json +1 -1
  41. package/prebuilds/provenance/darwin-x64.json +1 -1
  42. package/prebuilds/provenance/linux-x64.json +1 -1
package/dist/api.d.ts CHANGED
@@ -5,77 +5,412 @@ import { parallelCount } from './worker-count.js';
5
5
  import { CsvWorkerPool } from './worker-pool.js';
6
6
  import { parallelRows } from './worker-rows.js';
7
7
  /**
8
- * Parse one in-memory chunk into materialized rows.
8
+ * Parse one in-memory CSV buffer into materialized rows.
9
9
  *
10
- * Use this when you already own buffering and still want the high-level row API.
11
- * Accepts only single-thread row options, so `workerCount` is intentionally unavailable.
10
+ * Use this when the input is already buffered and a single promise containing all rows is suitable.
11
+ * The buffer is parsed as one complete input, so a record may not be split across calls. Use
12
+ * {@link rows} for file streaming and worker fan-out. `columns`/`selectedColumns` projects the
13
+ * returned rows, while strict validation (when enabled) still validates the complete row.
14
+ *
15
+ * @typeParam TColumns - Literal projected column indexes, when a projection is supplied.
16
+ * @param buffer - CSV bytes in a typed array or `DataView`.
17
+ * @param suppliedOptions - Parser options. Compression, automatic delimiter detection, and workers
18
+ * are not supported for in-memory parsing.
19
+ * @returns A promise that resolves to the materialized rows in input order.
20
+ * @throws {Error} If the options request compression, automatic delimiter detection, or an
21
+ * unsupported filtered strict-validation combination.
12
22
  */
13
- export declare function parse<TColumns extends CsvColumns | undefined = undefined>(buffer: NodeJS.TypedArray | DataView, options?: CsvParseOptions<TColumns>): Promise<CsvProjectedRow<TColumns>[]>;
23
+ export declare function parse<TColumns extends CsvColumns | undefined = undefined>(buffer: NodeJS.TypedArray | DataView, suppliedOptions?: CsvParseOptions<TColumns>): Promise<CsvProjectedRow<TColumns>[]>;
14
24
  /**
15
25
  * Stream materialized rows from a CSV file.
16
26
  *
17
- * Use this for the most direct high-level API. With `workerCount > 1`, the work
18
- * fans out across Bun workers.
27
+ * Each yielded value is one parser batch represented as ordinary string arrays. Options are
28
+ * captured when this function is called, before iteration starts, so mutating the caller-owned
29
+ * options object later does not change the stream. Set `workerCount` above one to use record-safe
30
+ * Bun worker shards; serial streams additionally support compression and automatic delimiter
31
+ * detection.
32
+ *
33
+ * @typeParam TColumns - Literal projected column indexes, when a projection is supplied.
34
+ * @param path - Path to the CSV file.
35
+ * @param options - File, projection, filter, validation, and optional worker settings.
36
+ * @returns An async generator of row batches. Serial parsing yields batches in file order; worker
37
+ * parsing yields batches as worker shards report them, so global file order is not guaranteed.
38
+ * @throws {Error} During iteration when the file cannot be read or the selected options are
39
+ * incompatible, such as strict filtered rows or compressed/auto-delimiter worker input.
19
40
  */
20
41
  export declare function rows<TColumns extends CsvColumns | undefined = undefined>(path: string, options?: CsvRowsOptions<TColumns>): AsyncGenerator<CsvProjectedRow<TColumns>[], void>;
42
+ /**
43
+ * Stream materialized rows through record-safe worker shards.
44
+ *
45
+ * `workerCount` must be greater than one. Workers require uncompressed input, an explicit
46
+ * delimiter, and non-strict validation; use {@link rows} for serial parsing or strict validation.
47
+ *
48
+ * @typeParam TColumns - Literal projected column indexes, when a projection is supplied.
49
+ * @param path - Path to the CSV file.
50
+ * @param options - Parallel row options, including the required worker count.
51
+ * @returns An async generator of materialized row batches.
52
+ * @throws {RangeError} If `workerCount` is not an integer greater than one.
53
+ * @throws {Error} If compression, automatic delimiter detection, or strict validation is enabled.
54
+ */
21
55
  export { parallelRows };
22
56
  export { CsvWorkerPool };
23
57
  /**
24
58
  * Stream native batches with explicit lifetime control.
25
59
  *
26
- * Use this when you want low-allocation access to row views or byte ranges and
27
- * are comfortable closing each batch yourself.
60
+ * Use this when you want low-allocation access to row views, byte ranges, and native-backed
61
+ * column data. Every yielded batch owns native memory and must be closed after use; prefer
62
+ * `for await (using batch of csv.batches(...))` or {@link withBatches} when possible.
63
+ * Options are captured at invocation time. Accessor indexes refer to fields stored in the batch;
64
+ * when filtering is combined with a projection, those stored fields are the projected output.
65
+ *
66
+ * @param path - Path to the CSV file.
67
+ * @param options - Serial file and parser options.
68
+ * @returns An async generator of disposable native batches.
69
+ * @throws {Error} During iteration when the file or validation fails, or when filtered strict
70
+ * validation is requested.
28
71
  */
29
72
  export declare function batches(path: string, options?: CsvBatchesOptions): AsyncGenerator<NativeCsvBatch, void>;
73
+ /**
74
+ * Process native CSV batches while managing each batch's lifetime.
75
+ *
76
+ * The callback may be asynchronous. Its batch remains valid until the callback settles and is
77
+ * closed in a `finally` block afterward, including when the callback throws.
78
+ *
79
+ * @param path - Path to the CSV file.
80
+ * @param options - Serial file and parser options.
81
+ * @param callback - Function invoked once per non-empty batch.
82
+ * @returns A promise that resolves after all batches have been processed.
83
+ * @throws {Error} The callback error, file error, or parser/validation error.
84
+ */
30
85
  export declare function withBatches(path: string, options: CsvBatchesOptions, callback: (batch: NativeCsvBatch) => void | Promise<void>): Promise<void>;
31
86
  /**
32
- * Stream reusable columnar batch views without materializing one JS string per field.
87
+ * Visit reusable columnar batch views without materializing one JavaScript string per field.
88
+ *
89
+ * The callback must be synchronous. A single view object is rebound for each batch and becomes
90
+ * invalid as soon as the callback returns, so copy any data that must outlive the callback. When
91
+ * `columns` is defined, batch column indexes are relative to the projected output order. Worker
92
+ * parsing and strict validation with selected columns are not supported by this API.
33
93
  *
34
- * When `columns` is defined, batch column indexes are relative to the projected
35
- * output order. This API is synchronous by design so the view can be safely reused.
94
+ * @typeParam TColumns - Literal projected column indexes, when a projection is supplied.
95
+ * @param path - Path to the CSV file.
96
+ * @param options - Serial file and columnar projection options.
97
+ * @param callback - Synchronous function invoked with a reusable view and batch index.
98
+ * @returns A promise that resolves after all batches have been visited.
99
+ * @throws {TypeError} If the callback returns a promise.
100
+ * @throws {Error} If worker parsing or an unsupported strict selected projection is requested.
36
101
  */
37
102
  export declare function forEachColumnarBatches<TColumns extends CsvColumns | undefined = undefined>(path: string, options: CsvColumnarBatchOptions<TColumns>, callback: CsvColumnarBatchCallback<TColumns>): Promise<void>;
103
+ /**
104
+ * Visit columnar batches when the selected-column tuple is not statically known.
105
+ * The callback must be synchronous and the reusable view is valid only during the callback.
106
+ *
107
+ * @param path - Path to the CSV file.
108
+ * @param options - Serial columnar options, or `undefined` for defaults.
109
+ * @param callback - Synchronous batch handler.
110
+ * @returns A promise that resolves after all batches are visited.
111
+ */
38
112
  export declare function forEachColumnarBatches(path: string, options: CsvColumnarBatchOptions | undefined, callback: CsvColumnarBatchCallback): Promise<void>;
113
+ /**
114
+ * Visit reusable columnar batch views with the same lifetime guarantees as
115
+ * {@link forEachColumnarBatches}. The callback is synchronous and the view is invalid after it
116
+ * returns.
117
+ *
118
+ * @typeParam TColumns - Literal projected column indexes, when a projection is supplied.
119
+ * @param path - Path to the CSV file.
120
+ * @param options - Serial file and columnar projection options.
121
+ * @param callback - Synchronous function invoked for each batch.
122
+ * @returns A promise that resolves after all batches have been visited.
123
+ */
39
124
  export declare function withColumnarBatches<TColumns extends CsvColumns | undefined = undefined>(path: string, options: CsvColumnarBatchOptions<TColumns>, callback: CsvColumnarBatchCallback<TColumns>): Promise<void>;
40
125
  /**
41
- * Stream reusable row views without materializing row arrays.
126
+ * Visit reusable row views without materializing row arrays.
42
127
  *
43
- * `selectedColumns` on the row view is metadata only. Row accessors still use
44
- * physical CSV column indexes; use `row.getPhysical()` for explicit call sites.
45
- * This API is synchronous by design so the view can be safely reused.
128
+ * The callback must be synchronous. A single view object is rebound for each row and becomes
129
+ * invalid when the callback returns, so copy strings or bytes that must be retained. The
130
+ * `selectedColumns` property records the requested source columns. Without `where`, accessors
131
+ * use physical CSV indexes. With both `where` and a projection, only projected fields may be
132
+ * stored, so accessor indexes are projected positions; use the metadata to map them back to
133
+ * source indexes. Worker parsing is not supported.
134
+ *
135
+ * @typeParam TColumns - Literal projected column indexes recorded in `selectedColumns`.
136
+ * @param path - Path to the CSV file.
137
+ * @param options - Serial file, projection, filter, and validation options.
138
+ * @param callback - Synchronous function invoked once per row.
139
+ * @returns A promise that resolves after all rows have been visited.
140
+ * @throws {TypeError} If the callback returns a promise.
141
+ * @throws {Error} If worker parsing is requested or the file/parser fails.
46
142
  */
47
143
  export declare function forEachRowViews<TColumns extends CsvColumns | undefined = undefined>(path: string, options: CsvRowViewsOptions<TColumns>, callback: CsvRowViewCallback<TColumns>): Promise<void>;
144
+ /**
145
+ * Visit row views when the selected-column tuple is not statically known.
146
+ * The callback must be synchronous and the reusable view is valid only during the callback.
147
+ *
148
+ * @param path - Path to the CSV file.
149
+ * @param options - Serial row-view options, or `undefined` for defaults.
150
+ * @param callback - Synchronous row handler.
151
+ * @returns A promise that resolves after all rows are visited.
152
+ */
48
153
  export declare function forEachRowViews(path: string, options: CsvRowViewsOptions | undefined, callback: CsvRowViewCallback): Promise<void>;
154
+ /**
155
+ * Visit reusable row views with the same lifetime guarantees as {@link forEachRowViews}.
156
+ *
157
+ * The callback is synchronous and the view is invalid after it returns.
158
+ *
159
+ * @typeParam TColumns - Literal projected column indexes recorded in `selectedColumns`.
160
+ * @param path - Path to the CSV file.
161
+ * @param options - Serial file, projection, filter, and validation options.
162
+ * @param callback - Synchronous function invoked once per row.
163
+ * @returns A promise that resolves after all rows have been visited.
164
+ */
49
165
  export declare function withRowViews<TColumns extends CsvColumns | undefined = undefined>(path: string, options: CsvRowViewsOptions<TColumns>, callback: CsvRowViewCallback<TColumns>): Promise<void>;
50
166
  /**
51
- * Count rows without materializing them.
167
+ * Count CSV records without materializing them.
168
+ *
169
+ * Filters created with `csv.column()` and composed with `csv.all()`, `csv.any()`, or `csv.not()`
170
+ * are evaluated by native fast paths. Set `workerCount` above one for parallel counting; workers
171
+ * require uncompressed input, an explicit delimiter, and non-strict validation. Serial counting
172
+ * supports compression and automatic delimiter detection.
173
+ *
174
+ * @param path - Path to the CSV file.
175
+ * @param suppliedOptions - Count, filter, validation, and optional worker settings.
176
+ * @returns A promise containing the record count.
177
+ * @throws {Error} If strict validation is combined with a filter, or if worker restrictions or
178
+ * file/parser errors are encountered.
179
+ */
180
+ export declare function count(path: string, suppliedOptions?: CsvCountOptions): Promise<number>;
181
+ /**
182
+ * Count records through record-safe worker shards.
183
+ *
184
+ * `workerCount` must be greater than one. Workers require uncompressed input, an explicit
185
+ * delimiter, and non-strict validation; use {@link count} for serial counting or strict checks.
52
186
  *
53
- * Full filter support exists here because count has native fast paths for
54
- * filters created with `csv.column()` and grouped with `csv.all()`, `csv.any()`, and `csv.not()`.
187
+ * @param path - Path to the CSV file.
188
+ * @param options - Parallel count options, including the required worker count.
189
+ * @returns A promise containing the total record count.
190
+ * @throws {RangeError} If `workerCount` is not an integer greater than one.
191
+ * @throws {Error} If compression, automatic delimiter detection, or strict validation is enabled.
55
192
  */
56
- export declare function count(path: string, options?: CsvCountOptions): Promise<number>;
57
193
  export { parallelCount };
58
- export declare function findCsvSafeSplitOffsets(path: string, shardCount: number, options?: CsvShardingOptions): number[];
59
- export declare function findCsvSafeShards(path: string, shardCount: number, options?: CsvShardingOptions): CsvShard[];
194
+ /**
195
+ * Find byte offsets that divide a CSV file only at record boundaries.
196
+ *
197
+ * The returned array contains shard start offsets followed by the terminal file boundary. Quoted
198
+ * fields and embedded newlines are respected. The operation reads the file directly, so compressed
199
+ * input and automatic delimiter detection are not supported.
200
+ *
201
+ * @param path - Path to the uncompressed CSV file.
202
+ * @param shardCount - Desired number of partitions; the result may contain fewer non-empty shards.
203
+ * @param suppliedOptions - Explicit delimiter and file parser options. Compression is unavailable.
204
+ * @returns Monotonically increasing byte offsets, including `0` and the file-length boundary.
205
+ * @throws {RangeError} If `shardCount` is not a positive integer.
206
+ * @throws {Error} If the delimiter is automatic, compressed, or invalid for native scanning.
207
+ */
208
+ export declare function findCsvSafeSplitOffsets(path: string, shardCount: number, suppliedOptions?: CsvShardingOptions): number[];
209
+ /**
210
+ * Find non-empty CSV byte ranges that begin and end at record boundaries.
211
+ *
212
+ * Shards use inclusive `start` and `end` offsets and never split quoted fields or embedded
213
+ * newlines. A small file can produce fewer non-empty shards than requested. The operation does
214
+ * not support compressed input or automatic delimiter detection.
215
+ *
216
+ * @param path - Path to the uncompressed CSV file.
217
+ * @param shardCount - Desired number of partitions; the result may contain fewer shards.
218
+ * @param suppliedOptions - Explicit delimiter and file parser options. Compression is unavailable.
219
+ * @returns Non-empty, ordered byte ranges suitable for independent worker processing.
220
+ * @throws {RangeError} If `shardCount` is not a positive integer.
221
+ * @throws {Error} If the delimiter is automatic, compressed, or invalid for native scanning.
222
+ */
223
+ export declare function findCsvSafeShards(path: string, shardCount: number, suppliedOptions?: CsvShardingOptions): CsvShard[];
224
+ /**
225
+ * Create a reusable pool for repeated parallel row and count operations.
226
+ *
227
+ * The pool captures its file options when created. `workerCount` must be greater than one, and
228
+ * pooled operations require uncompressed input, an explicit delimiter, and non-strict validation.
229
+ * Call `close()` (or use `using`) when the pool is no longer needed.
230
+ *
231
+ * @typeParam TColumns - Literal projected column indexes for pooled row operations.
232
+ * @param path - Path to the uncompressed CSV file.
233
+ * @param options - Parallel worker-pool options, including `workerCount`.
234
+ * @returns A reusable worker pool. Its `rows()` and `count()` methods are asynchronous.
235
+ * @throws {RangeError} If `workerCount` is not an integer greater than one.
236
+ * @throws {Error} If compression or automatic delimiter detection is enabled. Strict validation
237
+ * is rejected when `count()` or `rows()` is called on the returned pool.
238
+ */
60
239
  export declare function workerPool<TColumns extends CsvColumns | undefined = undefined>(path: string, options: CsvWorkerPoolOptions<TColumns>): CsvWorkerPool<TColumns>;
240
+ /**
241
+ * The package's file-oriented API namespace.
242
+ *
243
+ * The namespace combines materialization, counting, filtering, worker, batch, row-view, and
244
+ * record-safe sharding helpers in one discoverable object.
245
+ */
61
246
  export declare const csv: {
247
+ /**
248
+ * Combine one or more filters with logical AND semantics.
249
+ * @param first - First filter in the group.
250
+ * @param rest - Additional filters that must match.
251
+ * @returns An immutable conjunction filter.
252
+ */
62
253
  all: typeof all;
254
+ /**
255
+ * Combine one or more filters with logical OR semantics.
256
+ * @param first - First filter in the group.
257
+ * @param rest - Additional filters, any one of which may match.
258
+ * @returns An immutable disjunction filter.
259
+ */
63
260
  any: typeof any;
261
+ /**
262
+ * Select a zero-based physical CSV column for building reusable filters.
263
+ * @param columnIndex - Column index from 0 through 2024.
264
+ * @returns An immutable column predicate builder.
265
+ */
64
266
  column: typeof column;
267
+ /**
268
+ * Negate a filter while preserving missing-column unknown semantics.
269
+ * @param filter - Filter created by this API.
270
+ * @returns An immutable negation filter.
271
+ */
65
272
  not: typeof not;
273
+ /**
274
+ * Validate and brand a JavaScript regular expression for native matching.
275
+ * @param pattern - Expression using the supported RE2-compatible syntax and flags.
276
+ * @returns An immutable `CsvRegex` descriptor for low-level filter values.
277
+ */
66
278
  re: typeof re;
279
+ /**
280
+ * Create a reusable pool for parallel row and count operations.
281
+ * The pool captures its options at construction; close it when finished, and note that strict
282
+ * validation is rejected when `rows()` or `count()` starts.
283
+ * @param path - Path to an uncompressed CSV file.
284
+ * @param options - Parallel options with `workerCount` greater than one.
285
+ * @returns A reusable `CsvWorkerPool`.
286
+ */
67
287
  workerPool: typeof workerPool;
288
+ /**
289
+ * Parse one in-memory buffer into materialized rows.
290
+ * Compression, automatic delimiter detection, and workers are unavailable.
291
+ * @param buffer - CSV bytes in a typed array or `DataView`.
292
+ * @param suppliedOptions - In-memory parser and projection options.
293
+ * @returns A promise containing materialized rows in input order.
294
+ * @example
295
+ * ```ts
296
+ * import { csv } from '@konstit/csv';
297
+ * const rows = await csv.parse(Buffer.from('1,Ada\n2,Grace\n'), { columns: [1] });
298
+ * // [['Ada'], ['Grace']]
299
+ * ```
300
+ */
68
301
  parse: typeof parse;
302
+ /**
303
+ * Stream materialized row batches from a CSV file.
304
+ * Options are captured at invocation. Serial batches preserve file order; worker batches arrive
305
+ * as each shard reports them, without a global file-order guarantee.
306
+ * @param path - Path to the CSV file.
307
+ * @param options - File, projection, filter, validation, and worker settings.
308
+ * @returns An async generator of row batches.
309
+ * @example
310
+ * ```ts
311
+ * import { csv } from '@konstit/csv';
312
+ * for await (const rows of csv.rows('data.csv', { columns: [0, 2], delimiter: ';' })) {
313
+ * for (const row of rows) console.log(row);
314
+ * }
315
+ * ```
316
+ */
69
317
  rows: typeof rows;
318
+ /**
319
+ * Count records through record-safe worker shards.
320
+ * Workers require an explicit delimiter, uncompressed input, and non-strict validation.
321
+ * @param path - Path to the CSV file.
322
+ * @param options - Parallel count options with `workerCount` greater than one.
323
+ * @returns A promise containing the total record count.
324
+ */
70
325
  parallelCount: typeof parallelCount;
326
+ /**
327
+ * Stream materialized rows through record-safe worker shards.
328
+ * Worker batches are yielded as shards report them and are not globally ordered.
329
+ * @param path - Path to the CSV file.
330
+ * @param options - Parallel row options with `workerCount` greater than one.
331
+ * @returns An async generator of projected row batches.
332
+ */
71
333
  parallelRows: typeof parallelRows;
334
+ /**
335
+ * Stream disposable native-backed batches.
336
+ * Close every yielded batch, or use `for await (using batch of ...)`.
337
+ * @param path - Path to the CSV file.
338
+ * @param options - Serial file and parser options.
339
+ * @returns An async generator of `NativeCsvBatch` objects.
340
+ */
72
341
  batches: typeof batches;
342
+ /**
343
+ * Process native batches and close each one after the callback settles.
344
+ * @param path - Path to the CSV file.
345
+ * @param options - Serial file and parser options.
346
+ * @param callback - Synchronous or asynchronous batch handler.
347
+ * @returns A promise that resolves after all batches are processed.
348
+ */
73
349
  withBatches: typeof withBatches;
350
+ /**
351
+ * Visit reusable columnar batch views with a synchronous callback.
352
+ * The view is invalid after the callback returns; selected indexes are relative to projection.
353
+ * @param path - Path to the CSV file.
354
+ * @param options - Serial columnar options; workers are unsupported.
355
+ * @param callback - Synchronous batch handler.
356
+ * @returns A promise that resolves after all batches are visited.
357
+ */
74
358
  forEachColumnarBatches: typeof forEachColumnarBatches;
359
+ /**
360
+ * Visit reusable columnar batch views, closing native storage after each callback.
361
+ * The callback is synchronous and the view cannot be retained.
362
+ * @param path - Path to the CSV file.
363
+ * @param options - Serial columnar options.
364
+ * @param callback - Synchronous batch handler.
365
+ * @returns A promise that resolves after all batches are visited.
366
+ */
75
367
  withColumnarBatches: typeof withColumnarBatches;
368
+ /**
369
+ * Visit reusable row views with a synchronous callback.
370
+ * The view is invalid after the callback returns; workers are unsupported.
371
+ * @param path - Path to the CSV file.
372
+ * @param options - Serial row-view options.
373
+ * @param callback - Synchronous row handler.
374
+ * @returns A promise that resolves after all rows are visited.
375
+ */
76
376
  forEachRowViews: typeof forEachRowViews;
377
+ /**
378
+ * Visit reusable row views with the same lifetime rules as `forEachRowViews`.
379
+ * @param path - Path to the CSV file.
380
+ * @param options - Serial row-view options.
381
+ * @param callback - Synchronous row handler.
382
+ * @returns A promise that resolves after all rows are visited.
383
+ */
77
384
  withRowViews: typeof withRowViews;
385
+ /**
386
+ * Count CSV records without materializing them.
387
+ * Serial counting supports compression and automatic delimiter detection; filtered strict mode is unsupported.
388
+ * @param path - Path to the CSV file.
389
+ * @param suppliedOptions - Count, filter, validation, and worker settings.
390
+ * @returns A promise containing the record count.
391
+ * @example
392
+ * ```ts
393
+ * import { csv } from '@konstit/csv';
394
+ * const activeRows = await csv.count('data.csv', { where: csv.column(2).equals('active') });
395
+ * ```
396
+ */
78
397
  count: typeof count;
398
+ /**
399
+ * Find record-safe byte offsets, including the terminal file boundary.
400
+ * Compressed input and automatic delimiter detection are unsupported.
401
+ * @param path - Path to an uncompressed CSV file.
402
+ * @param shardCount - Desired number of partitions.
403
+ * @param suppliedOptions - Explicit delimiter and sharding options.
404
+ * @returns Monotonically increasing byte offsets.
405
+ */
79
406
  findCsvSafeSplitOffsets: typeof findCsvSafeSplitOffsets;
407
+ /**
408
+ * Find non-empty record-safe byte ranges for independent processing.
409
+ * Ranges use inclusive `start` and `end` offsets and may be fewer than requested.
410
+ * @param path - Path to an uncompressed CSV file.
411
+ * @param shardCount - Desired number of partitions.
412
+ * @param suppliedOptions - Explicit delimiter and sharding options.
413
+ * @returns Ordered, non-empty CSV byte ranges.
414
+ */
80
415
  findCsvSafeShards: typeof findCsvSafeShards;
81
416
  };