"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayBufferToBase64DataUrl = void 0;
/**
* !! Caution: runtime will be blocked if using this for a large buffer (large file like 1GB)
*
* @param buf The array buffer data
* @param contentType The MIME type .e.g text/plain
* @category arrayBuffer
* @module arrayBufferToBase64DataUrl
*/
function arrayBufferToBase64DataUrl(buf, contentType) {
var base64 = Buffer.from(buf).toString('base64');
var dataUrl = "data:".concat(contentType, ";base64, ").concat(encodeURIComponent(base64));
return dataUrl;
}
exports.arrayBufferToBase64DataUrl = arrayBufferToBase64DataUrl;
exports.default = arrayBufferToBase64DataUrl;
Source