szimek / sharedrop

Easy P2P file transfer powered by WebRTC - inspired by Apple AirDrop
https://www.sharedrop.io
MIT License
9.94k stars 725 forks source link

Is there a file size limit? #97

Closed honi closed 3 years ago

honi commented 3 years ago

I'm trying to send an 8GB file. After selecting the file nothing happens, no error, no progress. The other side doesn't see anything either.

Thanks!

szimek commented 3 years ago

Hi!

Does it work correctly for smaller files? Could you check if there are any errors reported on either of the devices in JS console?

In theory there's no size limit, though it's not really a use case that is well supported:

There are some new APIs coming out (e.g. https://web.dev/file-system-access/ and https://web.dev/wake-lock/) that might make transferring large files easier, but at the moment I don't have plans to use them due to lack of free time.

honi commented 3 years ago

Smaller files work ok, and there are no errors in the JS console.

After selecting the large file the confirmation prompt never appears. I'm guessing that it's just taking a long time to open the file on my end before showing the prompt and actually starting the transfer. I've waited for ~5min and nothing happened, but maybe it was just processing.

When you select a file, does it load the contents of the file into memory?

Anyways thanks for the response! I've managed already to transfer the file, and I understand this might not be a common use case. I'll definitely use this app for smaller files the next time. Feel free to close this issue :)

szimek commented 3 years ago

When you select a file, does it load the contents of the file into memory?

It doesn't, though I'm only 95% sure ;) It uses file input to get the file handle and then uses FileReader to get the contents of the file in 1MB chunks.

wahshibinharb commented 1 year ago

i use in my local server and installed with docker and can't send 6GB mp4 file. I check that server side there is no limit or anything. Am i missing something cause i can send 3gb zip file with no problem.

szimek commented 1 year ago

Hi @vincentpricex!

In theory there's a limit imposed by browsers when it comes to storing temporary data locally in the filsystem. Sharedrop uses an old and deprecated Chrome-only FileSystem API with fallback to IndexedDB for other browser. Unfortunately, I did not implement a check for available space before you start sending a file. Actually, I'm quite surprised that you were able to transfer 3GB file! :)

One solution would be to add this check, so that you would get a message about insufficient space before it starts transferring the file. Another solution could be to switch to a more modern filesystem API (https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API), but I didn't have time to look into it, so I don't know what constraints and limits it has.

BTW. Did you have to change anything to be able to run it locally in a Docker container? Did you have any problems with setting up Firebase account? I remember a few people saying that it doesn't work out of the box, so providing specific instructions on how to set it up would be useful to many.

wahshibinharb commented 1 year ago

i am truly sorry. I make mistake. I thought i am in snapdrop repo. This issue for snapdrop not here. I was checking your script to see any solution on here so i forgot where i was and open it mistakenly.. Sorry about it.