Giter Club home page Giter Club logo

sgdownloader's Introduction

SGdownloader is a small library for downloading file. It supported

  • Block
  • Delegate
  • ARC

You can use Block or Delegate for downloading the file. If you are using with TableView, you should use Delegate instead of Block.

Demo

I put downloadManager demo with tableview cell. It's using delegate method for delete the tableviewcell.

##How to use

Put

  • SGdownloader.h
  • SGdownloader.m

to your project.

###for using Block

SGdownloader *downloader = [[SGdownloader alloc] initWithURL:[NSURL URLWithString:@"http://myfile.com/file.jpg"] timeout:60];

[downloader startWithDownloading:(float progress,NSInteger percentage) {
	
	//progress for progress bar
	//percentage for download percentage
	
} onFinished:(NSData* fileData,NSString* fileName){
	
	//use NSData to write a file or image
	
}onFail (NSError* error){

	//on fail

}];

###for using Delegate put SGdownloader delegate at .h file

@interface progressCell : UITableViewCell <SGdownloaderDelegate>

in .m file

SGdownloader *downloader = [[SGdownloader alloc] initWithURL:[NSURL URLWithString:@"http://myfile.com/file.jpg"] timeout:60];

[downloader startWithDelegate:self];

Delegate Methods are required

-(void)SGDownloadProgress:(float)progress Percentage:(NSInteger)percentage;
-(void)SGDownloadFinished:(NSData*)fileData;
-(void)SGDownloadFail:(NSError*)error;

##Todo

  • allow 1-5 concurrent download for 1 file (like download manager)

#Example

check downloadManager.xcodeproj . All the downloading images are using from google search result. It is using for testing purporse only.

##Log

###Version 0.2

  • Allow Pause and Resume

###Version 0.1

  • Allow Download with Progress

sgdownloader's People

Contributors

saturngod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sgdownloader's Issues

SGDownloader

hello sir

When i use same url third time downloaded then second time url data downloaded and the same url open on browser then data correctly coming but i don't what is wrong with me

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.