Function convertUint8ArrayToMwFile

  • Converts a Uint8Array to a clean ArrayBuffer. Ensures type safety with ArrayBuffer vs SharedArrayBuffer.

    Parameters

    • uint8Array: Uint8Array

      The Uint8Array to convert.

    • name: string

      The name of the file.

    • type: string

      The MIME type of the file.

    Returns MwFile

    A MwFile object

    const pdfBytes = await pdfDoc.save();
    const mwFile = convertUint8ArrayToMwFile(pdfBytes, 'example.pdf', 'application/pdf');