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

SWC-7064 - Utilities for pre-upload #1353

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

nickgros
Copy link
Collaborator

@nickgros nickgros commented Nov 4, 2024

No description provided.

@nickgros nickgros changed the title SWC-7064 - Add utility to create Folders from a list of paths SWC-7064 - Utilities for pre-upload Nov 5, 2024
* @throws Error If an entity with given name and parent ID was found, but that entity
* was not a File Entity.
*/
export async function getFileEntityIdWithSameName(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the uploader, this function will tell us if we should ask the user if a file should be uploaded as a new version of an existing entity.

* Given the ID of a container entity and a path string array, create the folder structure as necessary and return the ID of the final folder in the path.
* @returns The ID of the final folder in the path.
*/
export function useCreateFolderPath() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When uploading an entire folder, we may need to create many nested folders. This hook handles creating those folders.

* Given a File to upload as a FileEntity, create a matching directory structure (as necessary)
* and return the ID of the folder in which the file should be uploaded.
*/
export function useCreatePathsAndGetParentId() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convenience wrapper over the useCreateFolderPath that takes a JavaScript File and parses the webkitRelativePath property to determine the path structure that should be created.

@nickgros nickgros merged commit 30072f5 into Sage-Bionetworks:main Nov 5, 2024
24 checks passed
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