Giter Club home page Giter Club logo

Comments (3)

mzeeshanid avatar mzeeshanid commented on May 25, 2024 1

Yes you can limit concurrent downloads. For example see the code sample below:

let ongoingTasks = mzDownloadingViewObj?.downloadManager.downloadingArray.filter({ (fileModel: MZDownloadModel) -> Bool in
            return fileModel.status == TaskStatus.downloading.description()
        })
        if (ongoingTasks?.count)! <= 5 {
            mzDownloadingViewObj?.downloadManager.addDownloadTask(fileName as String, fileURL: fileURL.addingPercentEscapes(using: String.Encoding.utf8.rawValue)!, destinationPath: myDownloadPath)
        }

When some task is finished it will call the delegate and you can add new task there.

More over you can use the fileURL property. Every file on your server must have unique url.

from mzdownloadmanager.

mzeeshanid avatar mzeeshanid commented on May 25, 2024

what if I need to download a bunch of files?
Yes you can download multiple files simultaneously. You can use the instance method addDownloadTask to add a task.
I don't know how many files I have to download, it depends on the server
You can add as many as tasks you want but it is recommended to apply some limit on running tasks.
I'd like to be able to track the download of every single file understanding when it finished
MZDownloadManager provides different delegate methods to inform about any event, check the docs or source.

from mzdownloadmanager.

andrealufino avatar andrealufino commented on May 25, 2024

You can add as many as tasks you want but it is recommended to apply some limit on running tasks.
Is not possible to limit the number of concurrent downloads in some way? Is there maybe a var?
MZDownloadManager provides different delegate methods to inform about any event, check the docs or source.
Yes, I saw them, but it's impossible to handle the downloads using the index var because often the index has the same value for multiple resources. How can I avoid this?

from mzdownloadmanager.

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.