We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6374f0e commit 3f11a9eCopy full SHA for 3f11a9e
packages/snaps-utils/src/base64.ts
@@ -11,8 +11,10 @@ import type { VirtualFile } from './virtual-file';
11
*/
12
export async function encodeBase64(input: Uint8Array | VirtualFile | string) {
13
const bytes = getBytes(input);
14
+ const isReactNative =
15
+ typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
16
// In the browser, FileReader is much faster than bytesToBase64. This is not supported in React Native however.
- if ('FileReader' in globalThis && navigator?.product !== 'ReactNative') {
17
+ if ('FileReader' in globalThis && !isReactNative) {
18
return await new Promise((resolve, reject) => {
19
const reader = Object.assign(new FileReader(), {
20
onload: () =>
0 commit comments