@@ -3,6 +3,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
33import axios from 'axios' ;
44import { Buffer } from 'buffer' ;
55import * as DocumentPicker from 'expo-document-picker' ;
6+ import * as FileSystem from 'expo-file-system' ;
67import * as Haptics from 'expo-haptics' ;
78import { Image } from 'expo-image' ;
89import * as ImageManipulator from 'expo-image-manipulator' ;
@@ -1194,17 +1195,7 @@ export default function Files() {
11941195 const fullAssetsPath = [ cleanStatic , cleanAssets ] . filter ( Boolean ) . join ( '/' ) ;
11951196 const newPath = `${ fullAssetsPath } /${ finalName } ` . replace ( / ^ \/ + / , '' ) . replace ( / \/ + / g, '/' ) ;
11961197
1197- const resp = await fetch ( lastPickedUri ) ;
1198- const blob = await resp . blob ( ) ;
1199- const base64 : string = await new Promise ( ( resolve , reject ) => {
1200- const reader = new FileReader ( ) ;
1201- reader . onload = ( ) => {
1202- const res = reader . result as string ;
1203- resolve ( res . split ( ',' ) [ 1 ] ) ;
1204- } ;
1205- reader . onerror = reject ;
1206- reader . readAsDataURL ( blob ) ;
1207- } ) ;
1198+ const base64 = await new FileSystem . File ( lastPickedUri ) . base64 ( ) ;
12081199
12091200 await axios . put ( `https://api.github.com/repos/${ repoPath } /contents/${ newPath } ` , {
12101201 message : `add!(assets): uploaded asset ${ finalName } ` ,
0 commit comments