react-native-google-drive-api-wrapper icon indicating copy to clipboard operation
react-native-google-drive-api-wrapper copied to clipboard

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

Open sam-uraii opened this issue 3 years ago • 3 comments

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....

sam-uraii avatar Aug 30 '22 11:08 sam-uraii

Can you download big files with my package?

RobinBobin avatar Aug 30 '22 11:08 RobinBobin

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

RobinBobin avatar Aug 30 '22 11:08 RobinBobin

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...

sam-uraii avatar Aug 30 '22 12:08 sam-uraii

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?

markmccoid avatar Nov 02 '23 19:11 markmccoid

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

RobinBobin avatar Nov 02 '23 19:11 RobinBobin

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.

markmccoid avatar Nov 03 '23 03:11 markmccoid

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>

RobinBobin avatar Nov 03 '23 07:11 RobinBobin

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!!

markmccoid avatar Nov 03 '23 12:11 markmccoid

Hmmm, very interesting.

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

🙏

RobinBobin avatar Nov 03 '23 12:11 RobinBobin

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.

markmccoid avatar Nov 03 '23 16:11 markmccoid

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

RobinBobin avatar Nov 03 '23 18:11 RobinBobin

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

RobinBobin avatar Nov 03 '23 20:11 RobinBobin

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,

markmccoid avatar Nov 04 '23 03:11 markmccoid

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

RobinBobin avatar Nov 04 '23 07:11 RobinBobin

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 avatar Nov 04 '23 08:11 RobinBobin

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

RobinBobin avatar Nov 04 '23 08:11 RobinBobin

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!

markmccoid avatar Nov 04 '23 14:11 markmccoid

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

RobinBobin avatar Nov 04 '23 16:11 RobinBobin

Sure! my email is marknccoid @ gmail.com

markmccoid avatar Nov 04 '23 16:11 markmccoid

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

markmccoid avatar Nov 04 '23 17:11 markmccoid

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 avatar Nov 04 '23 18:11 RobinBobin

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

RobinBobin avatar Nov 04 '23 19:11 RobinBobin

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!!

markmccoid avatar Nov 06 '23 02:11 markmccoid

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?

shubhadeep29 avatar Apr 29 '24 04:04 shubhadeep29

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

RobinBobin avatar Apr 29 '24 05:04 RobinBobin