Class WorkerThreadAsyncParser

Async parser that allows cancellation of the current parsing process.

The sync parser implementation is blocking the event loop, which can become quite problematic for large files. The default implementation is not actually async. It just wraps the sync parser in a promise. A real implementation would create worker threads or web workers to offload the parsing work.

Hierarchy (view full)

Constructors

Properties

hydrator: Hydrator
queue: Deferred<ParserWorker>[] = []
terminationDelay: number = 200

The termination delay determines how long the parser waits for a thread to finish after a cancellation request. The default value is 200(ms).

threadCount: number = 8

The thread count determines how many threads are used to parse files in parallel. The default value is 8. Decreasing this value increases startup performance, but decreases parallel parsing performance.

workerPath: string | (() => string)
workerPool: ParserWorker[] = []

Methods