@aws-amplify/storage
Version:
Storage category of aws-amplify
11 lines (7 loc) • 379 B
text/typescript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { toBase64 } from './client/runtime';
export const hexToUint8Array = (hexString: string) =>
new Uint8Array((hexString.match(/\w{2}/g)! ?? []).map(h => parseInt(h, 16)));
export const hexToBase64 = (hexString: string) =>
toBase64(hexToUint8Array(hexString));