RobinBobin / react-native-google-drive-api-wrapper

This wrapper facilitates the use of the Google Drive API in React Native projects.
110 stars 43 forks source link

How to overwrite files on gdrive? Is there any configuration for that on library side? #76

Closed affcue25 closed 2 years ago

affcue25 commented 2 years ago

Hi! I have been using this library to create files on gdrive. But now I feel a need to overwrite the file if its already exist with the same name in gdrive. I know there can be one solution to delete the file by fileId and then create it again.. but isnt it possible with only a single parameter that says "mute: false/true" that can overwrite files if already exists with the same name? Kindly direct me into something simpler.. Thanks

RobinBobin commented 2 years ago

I doubt there's a certain api for that, as there can be multiple entities with the same name at the same level. Do you need the id of the new file to stay the same? generateIds() can be used for that.

affcue25 commented 2 years ago

I doubt there's a certain api for that, as there can be multiple entities with the same name at the same level. Do you need the id of the new file to stay the same? generateIds() can be used for that.

I just want to have only 1 file with the same name.. If that already exists then just overwrite it.. In my case, I need to update/overwrite the file by name...

affcue25 commented 2 years ago

What happened is, if the user update the file and push it to gdrive then it create a new file.. with same name... It should overwrite it.. I am also saving the same file to dropbox, and it overwrites the file with same name..

RobinBobin commented 2 years ago

I see. Well, list() can be used to search files by name.

RobinBobin commented 2 years ago

Hi there, Can I do anything else to help?

Maybe setIdOfFileToUpdate() can be useful?

affcue25 commented 2 years ago

Thanks.. but for me, deleting file and then creating new one worked... So I am closing this issue..

tmaly1980 commented 7 months ago

@RobinBobin The API has a files.update() function, why does this not exist in the module? How else are we supposed to update a file, when the only function to write is createIfNotExists(). There's also a files.create() function that doesn't seem to have been ported either.

RobinBobin commented 7 months ago

RTFM. After you have done it, open an issue if something is unclear.