Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ Every task function receives an available `Worker` (or `null` when the pool
needs a new worker created) and **must** return an object with the worker to
recycle and the result:

```ts
```typescript
type WorkerPoolTask<T> = (
worker: Worker | null
) => Promise<{ worker: Worker; result: T }>
```

### ChunkQueue interface (`add` / `onIdle`)

```ts
```typescript
import { WorkerPool } from '@fideus-labs/worker-pool'

const workerUrl = new URL('./my-worker.js', import.meta.url).href
Expand Down Expand Up @@ -70,7 +70,7 @@ pool.terminateWorkers()
Submit an array of tasks at once with optional progress reporting and
cancellation:

```ts
```typescript
const pool = new WorkerPool(2)

const tasks = inputs.map((input) => createTask(input))
Expand Down Expand Up @@ -134,7 +134,7 @@ pnpm add @fideus-labs/fizarrita @fideus-labs/worker-pool zarrita

### Basic usage

```ts
```typescript
import { WorkerPool } from '@fideus-labs/worker-pool'
import { getWorker, setWorker } from '@fideus-labs/fizarrita'
import * as zarr from 'zarrita'
Expand All @@ -159,7 +159,7 @@ pool.terminateWorkers()
Both `getWorker` and `setWorker` support a `useSharedArrayBuffer` option for
additional performance:

```ts
```typescript
// Read — output allocated on SharedArrayBuffer, workers decode directly
// into shared memory (eliminates one transfer + one copy per chunk)
const chunk = await getWorker(arr, null, {
Expand Down Expand Up @@ -205,7 +205,7 @@ descriptive error message.

**Vite example:**

```ts
```typescript
// vite.config.ts
export default defineConfig({
server: {
Expand Down
Loading