Skip to content
Type

BufferTargetOptions

Options for BufferTarget.

ts
type BufferTargetOptions = {
	onFinalize?: (buffer: ArrayBuffer) => MaybePromise<unknown>;
};

See MaybePromise.

Used by

Events

onFinalize

ts
onFinalize?: ((buffer: ArrayBuffer) => unknown);

Called once the target has been finalized, with the complete output buffer. If you return a promise, it will be used to apply backpressure internally.

One use for this callback is for uploading to a server where the full buffer must be known before sending (e.g. S3 PutObject) and stream-uploading is not an option.

Released under the Mozilla Public License 2.0.