Reference Source

src/XKTModel/lib/toArraybuffer.js

/**
 * @private
 * @param buf
 * @returns {ArrayBuffer}
 */
export function toArrayBuffer(buf) {
    const ab = new ArrayBuffer(buf.length);
    const view = new Uint8Array(ab);
    for (let i = 0; i < buf.length; ++i) {
        view[i] = buf[i];
    }
    return ab;
}