timvisee / ffsend

:mailbox_with_mail: Easily and securely share files from the command line. A fully featured Firefox Send client.
https://gitlab.com/timvisee/ffsend
GNU General Public License v3.0
6.92k stars 182 forks source link

Support downloading multiple files #169

Open YDX-2147483647 opened 1 year ago

YDX-2147483647 commented 1 year ago

When downloading multiple files, Send concatenates all files into a raw stream. This PR checks the files manifest, and split the stream back to normal files.

Technical details

Research about the sever side

https://github.com/timvisee/ffsend/issues/134#issuecomment-1740348270

Implementation

If we are downloading multiple files (if metadata.mime() == "send-archive"):

  1. Allocate a temporary directory
  2. Prepare paths: Check each file in the manifest, and ask to overwrite if necessary
  3. Download the archive (a raw stream) to temp dir
  4. Post Process: Split the archive to output dir (fn split(archive: File, files: Vec<ManifestFile>))

Other changes

Additional information

Resolves #134

Please merge https://github.com/timvisee/ffsend-api/pull/82 first if you want to merge this PR.