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

getData only loads the last part of the file #1

Closed
pgainullin opened this issue May 26, 2021 · 3 comments
Closed

getData only loads the last part of the file #1

pgainullin opened this issue May 26, 2021 · 3 comments

Comments

@pgainullin
Copy link

Current code seems to overwrite the output collector with the last event in the stream. I fixed it locally in my project with this:

  Future<String?> getData(String fileID) async {
    final file = await driveHelper.driveAPI.files.get(
      fileID,
      downloadOptions: DownloadOptions.fullMedia,
    ) as Media;
    **String fileData = '';**
    await file.stream.listen((event) {
      **fileData += String.fromCharCodes(event);**
    }).asFuture();
    return fileData;
  }

happy to do a PR, but haven't really tested it yet

@theRookieCoder
Copy link
Owner

Thank you for pointing this out. I don't actually use this method anywhere so I hope you will have time to test this. Let me know if this works then I'll commit and publish the new version.

@theRookieCoder
Copy link
Owner

OK, I fixed this and other changes are in the changelog

@pgainullin
Copy link
Author

nice one, thanks

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

No branches or pull requests

3 participants
@pgainullin @theRookieCoder and others