signal-desktop/ts/util/canvasToArrayBuffer.ts
2021-08-05 20:17:05 -04:00

14 lines
406 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { canvasToBlob } from './canvasToBlob';
import { MIMEType } from '../types/MIME';
export async function canvasToArrayBuffer(
canvas: HTMLCanvasElement,
mimeType?: MIMEType,
quality?: number
): Promise<ArrayBuffer> {
const blob = await canvasToBlob(canvas, mimeType, quality);
return blob.arrayBuffer();
}