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

[TASK] Directory support - NO GTK #20

Open
RaresRacsan opened this issue Nov 15, 2024 · 0 comments
Open

[TASK] Directory support - NO GTK #20

RaresRacsan opened this issue Nov 15, 2024 · 0 comments

Comments

@RaresRacsan
Copy link
Owner

Feature Overview

What is the purpose of this feature?

  • Implement directory support for file transfers, allowing users to compress entire directories, send them from the server to the client, and extract them on the client-side. This will enable bulk file transfers for directories and their contents.

Objectives

What are the key goals of this feature?

  1. Enable the client to select an entire directory for compression and transfer.
  2. Ensure that directories, including subdirectories and files, can be compressed into a single archive (e.g., TAR, ZIP).
  3. Allow the server to send the compressed directory archive.
  4. Allow the client to receive the archive and extract the contents back into the original directory structure.
  5. Ensure that the integrity of the files is preserved, and that nested directories are correctly handled.

Requirements

What are the technical and functional requirements for this feature?

  • Functional Requirements:

    • The client should be able to select and compress an entire directory (with subdirectories and files) into a single compressed archive (e.g., TAR, ZIP).
    • The server should receive the compressed archive and transfer it to the client.
    • The client should be able to decompress the archive and restore the original directory structure.
    • The transfer process should maintain file permissions and other metadata (if applicable).
  • Technical Requirements:

    • Use an established compression format (e.g., TAR, ZIP) that supports directories and subdirectories.
    • Implement a method to recursively compress directories and their contents.
    • The client and server must be able to handle large archives efficiently.
    • The server must be able to serve a compressed directory (single archive file) just like it does with individual files.

Design and Architecture

Describe the design and technical architecture:

  1. Key components:
    • Modify the client.c to allow selecting and compressing a directory into an archive (e.g., using tar or zip).
    • Modify the server.c to handle receiving and sending compressed directory archives.
    • Modify file transfer logic to handle both individual files and directory archives.
    • Optionally, update the user interface to allow directory selection.

Implementation Plan

Outline the steps to implement the feature:

  1. Compression of Directories on the Client:

    • Implement logic in the client to recursively compress a directory into an archive (e.g., .tar, .zip) before sending.
    • Use a compression library or command-line tool to handle the compression (e.g., tar or zip).
  2. Transfer of the Compressed Directory Archive:

    • Modify the server to handle receiving and sending a directory archive (as a single compressed file).
    • Ensure the client can specify whether they want to send a directory rather than a single file.
  3. Decompression and Extraction on the Client:

    • On the client side, once the archive is received, implement decompression logic to extract the contents into the original directory structure.
    • Handle subdirectories and ensure that file paths are preserved.
  4. Testing and Validation:

    • Test with various directory sizes (small and large directories).
    • Ensure that directory contents are correctly transferred and decompressed.
  5. User Interface/Experience:

    • Optionally, provide a graphical interface or command-line flags for selecting directories for transfer.
    • Inform the user about the progress of compressing, transferring, and decompressing directories.

Testing Plan

Describe how this feature will be tested:

  1. Unit Tests:

    • Test directory compression to ensure that all files within the directory, including subdirectories, are compressed into a single archive.
    • Test the decompression logic to verify that the directory structure is maintained.
  2. Integration Tests:

    • Test the end-to-end transfer of directories, ensuring that files within subdirectories are preserved and restored on the client-side.
  3. End-to-End Tests:

    • Perform directory transfers with a variety of files (e.g., text files, images, etc.) and directories of different sizes to ensure that the process works smoothly.
    • Validate that the server can handle and send directories as archives, and the client can correctly decompress and extract them.
  4. Error Handling Tests:

    • Ensure that any errors in the compression or decompression process (e.g., missing files, corrupted archives) are properly handled.
    • Test how the system behaves when the archive is too large to be handled efficiently.

Risks and Challenges

Identify potential risks or challenges for this feature:

  • Compression Format Compatibility: Ensuring that the chosen format (e.g., ZIP, TAR) is compatible across different operating systems.
  • File System Issues: Handling symbolic links, file permissions, or hidden files in directories.
  • Large Directories: Handling large directories efficiently and ensuring that they don't cause memory or buffer issues.
  • Transfer Speed: Compressing large directories may take a long time, potentially impacting the user experience.
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

No branches or pull requests

1 participant