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

File resources sharing #8

Open
FelixYew opened this issue Nov 21, 2020 · 10 comments
Open

File resources sharing #8

FelixYew opened this issue Nov 21, 2020 · 10 comments
Labels

Comments

@FelixYew
Copy link

Possible to implement file sharing with nearby connection.

@VNAPNIC
Copy link
Owner

VNAPNIC commented Nov 21, 2020

No, the current only supports transfer data raw

@FelixYew
Copy link
Author

Please consider to include this feature. Thanks

@VNAPNIC VNAPNIC added the Future label Nov 21, 2020
@VNAPNIC
Copy link
Owner

VNAPNIC commented Nov 21, 2020

ok, u can follow the progress here
https://github.com/VNAPNIC/flutter_nearby_connections/projects/3

@prateekmedia
Copy link

👍 +1 for file sharing

@VNAPNIC
Copy link
Owner

VNAPNIC commented Jan 27, 2021

u can convert image into byte array and byte array to base64 String

like that:

List imageBytes = widget.fileData.readAsBytesSync();
print(imageBytes);
String base64Image = base64Encode(imageBytes);

@prateekmedia
Copy link

u can convert image into byte array and byte array to base64 String

What if someone wants to build a file sharing app using that, than this hack would not work. :(

@ether-how
Copy link

Is there a size limit? I tried sending the base64Image string but I cant receive it on the other device :(

@AliAlHourash
Copy link

Is there a size limit? I tried sending the base64Image string but I cant receive it on the other device :(

Did u solve this problem?

@ether-how
Copy link

ether-how commented Feb 8, 2022

Is there a size limit? I tried sending the base64Image string but I cant receive it on the other device :(

Did u solve this problem?

Kind of.
Since they're already in a base64 string, i split them up into strings of 1500 length and sent them one by one with the max number of parts and corresponding part number attached.
Once the receiver receives the the last part, do a check if the number of parts received is equal to the max number of parts. Then if nothing is missing, merge them into a single string and convert it to whatever you want. Eg. Image, File etc. I did this for images and voice recordings.

@serzhikdnepr
Copy link

Kind of.

@ether-how Can you provide a more detailed example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants