OptionalonCallback when engine configuration fallback occurs.
Called when the requested configuration fails and falls back to a safer configuration.
Not called if strict: true (throws error instead).
Common fallback scenario:
workerStrategy: "stream-transfer" → "message-streaming" (Safari)OptionalstrictStrict mode: disable automatic fallback.
Only applicable when workerStrategy: "stream-transfer".
When enabled:
onFallback is never calledWhen disabled (default):
onFallback if providedOptionalwasmUse WASM implementation.
Requires prior initialization with loadWASM.
OptionalworkerExecute in Worker thread.
OptionalworkerWorker pool for managing worker lifecycle.
Only applicable when worker: true.
When provided, the parsing function will use this pool's worker instance instead of creating/reusing a module-level singleton worker.
Use WorkerPool with the using syntax for automatic cleanup.
import { ReusableWorkerPool, parseString } from 'web-csv-toolbox';
async function processCSV(csv: string) {
using pool = new ReusableWorkerPool();
const records = [];
for await (const record of parseString(csv, {
engine: { worker: true, workerPool: pool }
})) {
records.push(record);
}
return records;
// Worker is automatically terminated when leaving this scope
}
import { ReusableWorkerPool, parseString } from 'web-csv-toolbox';
using pool = new ReusableWorkerPool();
await parseString(csv1, { engine: { worker: true, workerPool: pool } });
await parseString(csv2, { engine: { worker: true, workerPool: pool } });
// Worker is reused for both operations
OptionalworkerWorker communication strategy.
Only applicable when worker: true.
"message-streaming" (default): Message-based streaming
"stream-transfer": TransferableStreams
OptionalworkerCustom Worker URL.
Only applicable when worker: true.
If not provided, uses the bundled worker.
Engine configuration for CSV parsing.
All parsing engine settings are unified in this interface.