@aws-amplify/storage
Version:
Storage category of aws-amplify
19 lines (17 loc) • 654 B
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBase64 = void 0;
function bytesToBase64(bytes) {
const base64Str = Array.from(bytes, x => String.fromCodePoint(x)).join('');
return btoa(base64Str);
}
function toBase64(input) {
if (typeof input === 'string') {
return bytesToBase64(new TextEncoder().encode(input));
}
return bytesToBase64(new Uint8Array(input.buffer, input.byteOffset, input.byteLength));
}
exports.toBase64 = toBase64;
//# sourceMappingURL=index.browser.js.map
;