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

Allow streaming upload also for unknown length streams #5305

Open
2 tasks done
mifi opened this issue Jul 3, 2024 · 2 comments · May be fixed by #5489
Open
2 tasks done

Allow streaming upload also for unknown length streams #5305

mifi opened this issue Jul 3, 2024 · 2 comments · May be fixed by #5489
Labels

Comments

@mifi
Copy link
Contributor

mifi commented Jul 3, 2024

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

Yes companion now streams most files without first storing them when setting COMPANION_STREAMING_UPLOAD=true, however it still downloads the whole file first when encountering a file of unknown length (missing content-length header):

if (this._needDownloadFirst()) {

This happens because for some of the uploaders we need to know the size of the file before uploading. I know that this happens for the Google Drive plugin when uploading files from Google Docs (export). It can also happen if someone uses the URL plugin to download/upload a file which doesn't have a content-length.

This is problematic for large files (e.g. 100gb) because it requires a lot of storage space.

Solution

When using an uploader that supports it (tus, xhr/multipart, s3?) we can upload directly without knowing the size.

Alternatives

leave it

@mifi mifi added the Feature label Jul 3, 2024
@Acconut
Copy link
Member

Acconut commented Jul 4, 2024

Just repeating my comment to add more info for tus:

Companion does not even have to count the bytes on its own. You can pass tus-js-client a readable stream while enabling uploadLengthDeferred and setting chunkSize. Then it will count the bytes on its own and let the server know the size once the readable stream closed.

It's worth noting that this feature requires the tus server to support an optional extension. While most tus server provide this, it is not always the case. So maybe an option to disable this for tus uploads is helpful.

@mifi
Copy link
Contributor Author

mifi commented Oct 21, 2024

I just tested and it seems to be working! Will create a PR

mifi added a commit that referenced this issue Oct 21, 2024
seems to be working
closes #5305
@mifi mifi linked a pull request Oct 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants