Remove react-native-fs (#5463)

* remove rnfs

* tweak e2e

* log

* use `safeDeleteAsync`
This commit is contained in:
Hailey
2024-09-24 09:28:12 -07:00
committed by GitHub
parent b9516202fa
commit d2fae81b33
4 changed files with 29 additions and 29 deletions
+5 -3
View File
@@ -1,6 +1,8 @@
import RNFS from 'react-native-fs'
import {copyAsync} from 'expo-file-system'
import {BskyAgent, ComAtprotoRepoUploadBlob} from '@atproto/api'
import {safeDeleteAsync} from '#/lib/media/manip'
/**
* @param encoding Allows overriding the blob's type
*/
@@ -65,7 +67,7 @@ async function withSafeFile<T>(
// temporary file).
const newPath = uri.replace(/\.jpe?g$/, '.bin')
try {
await RNFS.copyFile(uri, newPath)
await copyAsync({from: uri, to: newPath})
} catch {
// Failed to copy the file, just use the original
return await fn(uri)
@@ -74,7 +76,7 @@ async function withSafeFile<T>(
return await fn(newPath)
} finally {
// Remove the temporary file
await RNFS.unlink(newPath)
await safeDeleteAsync(newPath)
}
} else {
return fn(uri)