From d2fae81b33ae0a73d0b9f87700365d60bc51f094 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 24 Sep 2024 09:28:12 -0700 Subject: Remove `react-native-fs` (#5463) * remove rnfs * tweak e2e * log * use `safeDeleteAsync` --- src/lib/api/upload-blob.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/lib/api/upload-blob.ts') diff --git a/src/lib/api/upload-blob.ts b/src/lib/api/upload-blob.ts index 0814d5185..07aeaf1a7 100644 --- a/src/lib/api/upload-blob.ts +++ b/src/lib/api/upload-blob.ts @@ -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( // 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( return await fn(newPath) } finally { // Remove the temporary file - await RNFS.unlink(newPath) + await safeDeleteAsync(newPath) } } else { return fn(uri) -- cgit 1.4.1