GithubHelp home page GithubHelp logo

Comments (2)

Noctunus avatar Noctunus commented on May 29, 2024 1

For this the target file size has to be known up-front and at least the HTTP standard allows chunked transfer of files where you only know that the file is completed if it's returned as completed in the last chunk. Therefore a fail-proof way to receive files would be to save it to a temporary filename and only if it's finished successful rename it to the target filename. This would solve several things at once:

  1. You can be sure that the target filename is a complete file instead of only a part in an error case.
  2. If the target filename is already present you can just skip it without looking at sizes.
  3. Resuming a download would be possible as you know that the temp filename only consists of a part - to keep it simple you could just skip this and re-download the whole file with the same temp filename just overwriting the old data.

Also the implementation should be pretty simple (assuming the target filename is $name) :

  1. If $name already exists just skip the current file
  2. For the downloading just add a ".tmp" as suffix
  3. On successful download rename $name.tmp to $name

from crunchyroll-dl.

Platypuschan avatar Platypuschan commented on May 29, 2024

Mhm i´m just a scriptkiddie, but what´s about a more elaborated thingy like

if $already-existing-file-size != $size-of-file-to-download {
    rm $already-existing-file && download $new-file

from crunchyroll-dl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.