react-native-fs/Downloader.h

25 lines
897 B
C
Raw Normal View History

#import <Foundation/Foundation.h>
2016-05-30 23:13:50 +01:00
typedef void (^DownloadCompleteCallback)(NSNumber*, NSNumber*);
typedef void (^ErrorCallback)(NSError*);
typedef void (^BeginCallback)(NSNumber*, NSNumber*, NSDictionary*);
typedef void (^ProgressCallback)(NSNumber*, NSNumber*);
@interface DownloadParams : NSObject
@property (copy) NSString* fromUrl;
@property (copy) NSString* toFile;
2016-05-30 23:13:50 +01:00
@property (copy) DownloadCompleteCallback completeCallback; // Download has finished (data written)
@property (copy) ErrorCallback errorCallback; // Something went wrong
@property (copy) BeginCallback beginCallback; // Download has started (headers received)
@property (copy) ProgressCallback progressCallback; // Download is progressing
@end
@interface Downloader : NSObject <NSURLConnectionDelegate>
- (void)downloadFile:(DownloadParams*)params;
- (void)stopDownload;
@end