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

Add support for file versions #214

Draft
wants to merge 2 commits into
base: next
Choose a base branch
from
Draft

Add support for file versions #214

wants to merge 2 commits into from

Conversation

qgustavor
Copy link
Owner

@qgustavor qgustavor commented Sep 8, 2024

Calling .upload() on a file overrides it adding a new version.

Missing:

  • Handle naming: it should use the original file name I guess.
  • Handle how revisions work: at the moment the library is unaware of revisions and seems to always download the newest one.
  • Testing: testing on the real server, then implementing the server logic in mega-mock, then writing tests, then testing on real server again

@qgustavor
Copy link
Owner Author

I don't like this API: if we change .upload() to handle file revisions, it makes it messier. Some options I considered/consider:

  • Call .upload() on the parent folder, provide the overridden file as a parameter. It was the initial implementation, but seemed too not intuitive.
  • Call .upload() on the file, which is the current implementation, but you need to provide a file name on the first parameter anyway, which is not intuitive again.
  • Changing the current implementation to not require the first parameter in case of a file is being overridden can cause some TypeScript typing shenanigans I prefer to avoid.
  • Create an .uploadRevision() method instead? Like with .link() and .shareFolder(), one can just call the other method internally, but avoiding making the API non-intuitive.

@qgustavor qgustavor changed the title Add support for file revisions Add support for file versions Sep 8, 2024
@qgustavor
Copy link
Owner Author

qgustavor commented Sep 8, 2024

Implemented uploadVersion and changed the wording to match the original MEGA clients. The current implementation avoids the naming problem while being more intuitive. The current code is still unaware of file versions.

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.

1 participant