Giter Site home page Giter Site logo

ryanfu / srdownloadmanager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guowilling/srdownloadmanager

0.0 1.0 0.0 513 KB

Files download manager based on NSURLSessionDataTask, support breakpoint download, provide download state、 progress、completion callback.

License: MIT License

Objective-C 100.00%

srdownloadmanager's Introduction

SRDownloadManager

Features

  • Provides download status callback, download progress callback, download complete callback.
  • Support multi-task at the same time to download.
  • Support breakpoint download even exit the App.
  • Support to delete the specified file by URL and clear all files that have been downloaded.

  • 提供下载状态回调, 下载进度回调, 下载完成回调.
  • 支持多任务同时下载.
  • 支持断点下载, 即使退出重启 App.
  • 支持通过 URL 删除指定文件和清除所有已下载的文件.

Show

image

Installation

Drag the SRDownloadManager folder to the project.

Usage

[[SRDownloadManager sharedManager] download:fileURL state:^(SRDownloadState state) {
    // Called when download state changed.
} progress:^(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress) {
    // Called when download receive data every time.
} completion:^(BOOL isSuccess, NSString *filePath, NSError *error) {
    // Called when download finished with success or error.
}];

API

+ (instancetype)sharedManager;

- (void)download:(NSURL *)URL
           state:(void(^)(SRDownloadState state))state
        progress:(void(^)(NSInteger receivedSize, NSInteger expectedSize, CGFloat progress))progress
      completion:(void(^)(BOOL isSuccess, NSString *filePath, NSError *error))completion;

- (BOOL)isCompleted:(NSURL *)URL;

- (NSString *)fileFullPath:(NSURL *)URL;

- (CGFloat)fileProgress:(NSURL *)URL;

- (void)deleteFile:(NSURL *)URL;

- (void)deleteAllFiles;

If you have any question, submit an issue or contact me.
If this repo helps you, please give it a star.
Have Fun.

srdownloadmanager's People

Contributors

guowilling avatar

Watchers

 avatar

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.