Skip to content

AbortOptions

Defined in: next/api.d.ts:240

The signal option of compress, decompress and trainDictionary, which their *Sync variants do not take.

optional signal?: AbortSignalLike

Defined in: next/api.d.ts:261

A signal that withdraws the call when it aborts. The call then rejects with the reason of the signal, as it is, which carries no ErrorCode; with a signal that is already aborted, it rejects so at once, without starting any work.

Withdrawing is best effort. In Node.js, the call rejects at once if no thread of the libuv pool has started its work yet, and the pool then skips the work. Work that has started finishes, and the call rejects once it has, discarding its result: the codecs cannot stop midway. The browser build does the work before the function returns, so an abort only discards the result. A call that settled before the abort keeps its result.

The signal may be an AbortSignal of any realm, or an object with its members aborted, reason, addEventListener() and removeEventListener() (AbortSignalLike); any other value fails with ERR_COMPRS_INVALID_ARG. The call listens to the signal until it settles, and never sets its onabort property.