Skip to content

diffImagesAsync

diffImagesAsync(baseline, current, options): Promise<DiffResult>

Defined in: packages/image/src/async.ts:46

Diff two PNGs without blocking the event loop; same result as diffImages.

Runs on a shared worker_threads pool (max(1, availableParallelism() - 1) threads, or STORYSHELF_DIFF_WORKERS; 0 means in-thread) and falls back to the in-thread path when threads are unavailable. The buffers may be transferred to a worker, which detaches them in the caller: do not read them afterwards.

The pool is process-scoped, not owned by the capture consumer, so the re-diff route benefits even on an instance that never renders.

Buffer

Buffer

DiffOptions

Promise<DiffResult>