typescript
function spawnWorker(
script: string,
options: WorkerThreadsDriverOptions
): Promise<WorkerThreadsChannel>Spawn a worker thread and establish communication channel.
Parameters
| Name | Type | Description |
|---|---|---|
| script | string | Path to the worker script (or code if eval is true) |
| options | WorkerThreadsDriverOptions | Spawn options |
Returns
Promise<WorkerThreadsChannel>