-export const fixedPool = new FixedThreadPool<MyData, Promise<MyResponse>>(
- 8,
- join(__dirname, "worker.js"),
+import {
+ availableParallelism,
+ DynamicThreadPool,
+ FixedThreadPool,
+} from 'poolifier'
+
+import type { MyData, MyResponse } from './worker.js'
+
+const workerFile = join(
+ dirname(fileURLToPath(import.meta.url)),
+ `worker${extname(fileURLToPath(import.meta.url))}`
+)
+
+const fixedPool = new FixedThreadPool<MyData, MyResponse>(
+ availableParallelism(),
+ workerFile,