xresloader / upload-to-github-release

MIT License
52 stars 10 forks source link

Files are loaded into memory instead of streamed #52

Closed enumag closed 5 months ago

enumag commented 8 months ago

Hi, I checked your source code and found this line:

https://github.com/xresloader/upload-to-github-release/blob/8e0ffc2bf70a36035a8b5479d0903041cb11423f/src/index.ts#L721C37-L721C49

Releases can contain several large files so this way the runner can easily run out of memory and crash.

I found this while looking for alternatives when I discovered the same issue in another similar tool.

owent commented 8 months ago

Good point and thanks.

enumag commented 8 months ago

I'm no JS expert but probably you need to use something like this: https://www.geeksforgeeks.org/node-js-fs-createreadstream-method/

owent commented 8 months ago

I'm no JS expert but probably you need to use something like this: https://www.geeksforgeeks.org/node-js-fs-createreadstream-method/

GitHub's APIs do not accept read stream as data parameter. I will try to use @file_path to see if it will use stream internally.

enumag commented 8 months ago

Ouch... that would be rather nasty if Octokit itself requires the data to be loaded in memory. 😳 I hope it's not the case.

owent commented 8 months ago

I have raise #55 to try to use @file_path to upload file. But I have no repo which can be used to test a large asset file. Could you please try v1 branch or main branch to see if it work?

enumag commented 8 months ago

It doesn't work. The action succeeded and seemingly did actually upload the files however the files are just a few bytes large and contain the path to the file in the worker rather than the correct content.

owent commented 8 months ago

Thanks, I will try to find another way to fix this problem later.

github-actions[bot] commented 5 months ago

This issue was marked as stale due to lack of activity.