Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS files missing or deleted after several minutes #237

Closed
IvanCaceres opened this issue Aug 30, 2019 · 6 comments
Closed

iOS files missing or deleted after several minutes #237

IvanCaceres opened this issue Aug 30, 2019 · 6 comments

Comments

@IvanCaceres
Copy link

Acessing the file and filepath are working as intended initially but after a period of several minutes accessing the file again will result in the file not being found or missing.

This is on iOS. Could it be that because the files are in a temporary path /tmp/ they're being cleaned?

What would be the recommended solution here? Copying or moving the file to another directory?

@IvanCaceres IvanCaceres changed the title iOS files no longer available or deleted after several minutes iOS files missing or deleted after several minutes Aug 30, 2019
@pt9dat
Copy link

pt9dat commented Aug 31, 2019

same here, both on Android and iOS

@IvanCaceres
Copy link
Author

@pt9dat i solved this by moving the video file using react-native-filesystem,

i suspect it's a temporary file so i moved it to the cache directory

hope this helps

@pt9dat
Copy link

pt9dat commented Sep 3, 2019

@IvanCaceres thanks so much

@EyMaddis
Copy link

EyMaddis commented Sep 9, 2019

@IvanCaceres do you have some code to show. I would think that it is rather trivial, but the copyFile callback never triggers on Android.

          const folder = `${TemporaryDirectoryPath}/fileUpload/${Date.now()}`
          const newPath = `${folder}/${file.name}`
          console.warn('copying file from %s to', file.uri, newPath)

          try {
            await mkdir(folder, {
              NSURLIsExcludedFromBackupKey: true,
            })
            console.warn('MKDIR DONE') // called
            await copyFile(file.uri, newPath)
            console.warn('COPY DONE') // never called
          } catch (e) {
            // never called
         }

@msaqlain
Copy link
Contributor

Can we get a solution ??

@vonovak
Copy link
Collaborator

vonovak commented Jul 20, 2020

On iOS, the solution is to use the copyTo option.

Closing because the original issue is resolved.

@vonovak vonovak closed this as completed Jul 20, 2020
@react-native-documents react-native-documents locked and limited conversation to collaborators Jul 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants