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

Large files(250MB+) files(mostly Videos) are not working on download #73

Closed sam-uraii closed 1 year ago

sam-uraii commented 2 years ago

Premise: I am uploading a 250+MB video file with my own written resumable download function, the uploading is happening successfully as I can watch the video in the drive.

Problem: when I download the file and try to write it in temporary file path using react-native-fs but the file is not playable but at the same time with the same code and everything I do this for 100MB of file it's working very smoothly.....

it can be a problem with the file system if it is then please suggest a file system library which can write big chunk of file.....

or if I missing something please suggest....

RobinBobin commented 2 years ago

Can you download big files with my package?

RobinBobin commented 2 years ago

I have nothing to do with react-native-fs so I can't give you advice on it.

sam-uraii commented 2 years ago

Thanks for the reply.....even if am able to download the file I m not able to make sure that is complete data or not.....So ok...I'll first make sure what the problem is then I'll tell you what the inference is.

Ps: Great job of creating this library....Thanks a lot...

markmccoid commented 1 year ago

I'm having trouble downloading binary files (mp3) using React Native. I have tried the files.getBinary(), but I'm not sure what to do with the return data. Could you share the code that you used to download the video files from Google Drive?

RobinBobin commented 1 year ago

Did you have a look at the sample project? The link is in the readme.

markmccoid commented 1 year ago

Hi,

Yes and it seems very straightforward, but my code is throwing an error. I pull a list of files and then grab a fileId to an mp3 file that I want to download and store in the apps directory (I'm using Expo's FileSystem package).

`const token = (await GoogleSignin.getTokens()).accessToken; gdrive.accessToken = token; // const files = await gdrive.files.list(); // console.log(files);

// I get the following error on this call: // [TypeError: Cannot read property 'length' of undefined] const binData = await gdrive.files.getBinary( "1bbdiTlNlvtxgkt1j3jVdau0Fvt8J2-c7", undefined, "1-1" );

  const filename = `${FileSystem.documentDirectory}test.mp3`;

... ` Of course, I'm not even sure how to save a binary file with Expo. I was able to use downloadAsync for Dropbox files, but Google's webContentLink is not authorized, so downloadAsync won't work.

Thank you for the library, it certainly made it easier to list files and grab text files.

ANy direction would be appreciated.

RobinBobin commented 1 year ago

What will happen if you omit the third parameter? I'm pretty sure you will get only one byte with it, anyway. I think it will be much easier for me to help you if you find it possible to share the file you are trying to download with me. четверг, 02 ноября 2023г., 22:28 +03:00 от Mark @.*** :

I'm having trouble downloading binary files (mp3) using React Native. I have tried the files.getBinary(), but I'm not sure what to do with the return data. Could you share the code that you used to download the video files from Google Drive? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you commented. Message ID: @ github . com>

markmccoid commented 1 year ago

I have tried the following with the same results.

const binData = await gdrive.files.getBinary("1bbdiTlNlvtxgkt1j3jVdau0Fvt8J2-c7");

I didn't see who to share with, so I opened the file up for everyone. It is only 1.1 Meg in size.

https://drive.google.com/file/d/1rZlpBYMMh6CZBzNkTa7mkGrccFNN8QUX/view?usp=drive_link

Thanks for your help!!

RobinBobin commented 1 year ago

Hmmm, very interesting.

Got it, it's an audio "HellBoy something". Will look into the issue.

🙏

markmccoid commented 1 year ago

Yes! Thank you!!

As a side note, I'm using a custom dev build of Expo SDK 49 and I'm trying to simply write that file to the document directory as described by FileSystem.documentDirectory.

RobinBobin commented 1 year ago

I tried reading your file with my sample application and everything was fine. Can you do the same, please?

RobinBobin commented 1 year ago

I had to do export NODE_OPTIONS=--openssl-legacy-provider before running yarn start.

markmccoid commented 1 year ago

I couldn't get the sample app to run. It's been awhile since I ran react native without Expo.

But I have updated a sample where I think I'm doing the same thing that your app is doing.

https://github.com/markmccoid/googleauth

I made sure I had the same scopes as your sample app.

I'm sure it is something I"m missing, but I have tried calling getBinary with and without the last two parameters and still get the length error.

Thanks,

RobinBobin commented 1 year ago

It's great you shared your repo, I'll have a look.

RobinBobin commented 1 year ago

I cloned your repo, but I can't run the app :smile: . If I run npm run android I get Error Signing in-> 10, when trying to sign in to my account. If I run npm run ios I get iOS apps can only be built on macOS devices. Use eas build -p ios to build in the cloud. And if I run eas build -p ios I'm finally asked to log in to my Apple Developer account, which I don't have.

I don't have a mac. Can you setup your project for android?

RobinBobin commented 1 year ago

Or we can meet in zoom / google meet. What's your time zone?

markmccoid commented 1 year ago

Sure, we can meet via zoom or google meet. I focus on ios apps, so I wouldn't know where to start with Android.

I'm in the Eastern time zone and stay up late or will get up early!

RobinBobin commented 1 year ago

I'm in UTC+3, it's almost 8 pm here. Will you be available in an hour?

markmccoid commented 1 year ago

Sure! my email is marknccoid @ gmail.com

markmccoid commented 1 year ago

Shoot, I missed that it was 49 minutes ago. Drop me an email and maybe tomorrow we can meet. Thank you!!

RobinBobin commented 1 year ago

I tried sending you an email, but it didn't work.Screenshot_2023-11-04-21-08-03-23_e44fa99f58f790bd03ced9103cac0fbe.jpg

My google account is robinbobin1979@gma­il.com.

I will be working to­morrow 😒, but we'll do something about it.

My phone number in case you use WhatsApp +7-916-639-32-41

If you have time in the nearest hour it will be great.

RobinBobin commented 1 year ago

I'll close the issue. Please, open a new one if you need to, @markmccoid .

markmccoid commented 12 months ago

I just wanted to publicly thank @RobinBobin for taking the time to personally help me with figuring out the issue I was having.

Thank you!!

shubhadeep29 commented 6 months ago

Hi @RobinBobin @markmccoid , I need assistance with uploading and downloading a zip file. Could you provide an example code or guidance on how to do this?

RobinBobin commented 6 months ago

@shubhadeep29 Please open a new issue describing what you want to do, what you have done and what is not working.