API Reference/spawnWorker
function

spawnWorker

typescript
function spawnWorker(
  script: string,
  options: WorkerThreadsDriverOptions
): Promise<WorkerThreadsChannel>

Spawn a worker thread and establish communication channel.

Parameters

NameTypeDescription
scriptstringPath to the worker script (or code if eval is true)
optionsWorkerThreadsDriverOptionsSpawn options

Returns

Promise<WorkerThreadsChannel>