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

Remove fs stat and use bytesWritten as content length #2683

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

mejiaej
Copy link
Contributor

@mejiaej mejiaej commented Dec 7, 2020

Hi, as described in this issue. I want to avoid any potential fs.stat delay which can be caused by infrastructure such as EFS. The best way to do it is to remove any potential delay between the creation of the readStream and the HTTP request to the destination.

I found that this.bytesWritten contains the number of bytes of the file downloaded from a provider(google drive, one drive, etc.). And, because companion uploads that same file it is safe to use it as content-length when uploading. In fact, the code already uses this.bytesWritten as a synonym of bytesTotal

please let me know if there is anything that I didn't clearly explain.

cc @kvz this is a better solution than fs.statSync which I brought up on a previous PR that I closed.

@ifedapoolarewaju ifedapoolarewaju merged commit f09de1a into transloadit:master Dec 8, 2020
@ifedapoolarewaju
Copy link
Contributor

thank you!

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

Successfully merging this pull request may close these issues.

2 participants