Make conversion cancelable

This commit is contained in:
Vanilagy
2025-02-09 17:55:59 +01:00
parent 02ac371011
commit b3cd4de1f6
3 changed files with 68 additions and 1 deletions
+20
View File
@@ -86,8 +86,26 @@ export class Output<
/** @internal */
_finalizing = false;
/** @internal */
_finalized = false;
/** @internal */
_mutex = new AsyncMutex();
get isStarted() {
return this._started;
}
get isCanceled() {
return this._canceled;
}
get isFinalizing() {
return this._finalizing;
}
get isFinalized() {
return this._finalized;
}
constructor(options: OutputOptions<F, T>) {
if (!options || typeof options !== 'object') {
throw new TypeError('options must be an object.');
@@ -334,6 +352,8 @@ export class Output<
await this._writer.flush();
await this._writer.finalize();
this._finalized = true;
release();
}
}