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

feat: tar-stream library instead of tar-js (#360) #895

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomicvladan
Copy link
Collaborator

Using the tar-stream library which creates tar as a stream.

@agazso
Copy link
Member

agazso commented Dec 15, 2023

Does this work in a browser?

@tomicvladan
Copy link
Collaborator Author

No, this is just a fix for nodeJS to overcome size limitation.

@AuHau
Copy link
Contributor

AuHau commented Dec 18, 2023

You can make work tar-stream in a browser, but the NodeJs APIs (Buffer etc) need to by polyfilled. I have done it here: https://github.com/rsksmart/rif-storage-js/blob/master/src/swarm-mini/index.ts

But not sure if it is good idea. It is quite painful.

@AuHau
Copy link
Contributor

AuHau commented Dec 18, 2023

Oh right, exactly for this reason I pushed actually to implement streaming support, but it got never merged :-(

There is draft PR for that here: #372

@tomicvladan
Copy link
Collaborator Author

Using a polyfill for Node structures could be a solution, but I think it's more efficient to use browser streams:

https://developer.mozilla.org/en-US/docs/Web/API/Streams_API

It can work with Axios as well.

@agazso
Copy link
Member

agazso commented Jan 26, 2024

From previous experience the Streams API have several issues regarding compatibility, ease of use and maintenance. Also using tar can be considered as a workaround from the Swarm API perspective to allow working with multiple folders and files.

Personally I think it would be more interesting and future-proof to use the Swarm chunk API as an alternative with the help of external projects (bmt-js, mantaray-js) as it matches better the semantics of the problem space and thus could open up new directions, provide better control and create optimization opportunities. But that solution may be a separate library in itself and thus outside of the scope of bee-js.

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

Successfully merging this pull request may close these issues.

3 participants