react-native-fs/Downloader.h

33 lines
1.3 KiB
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*);
typedef void (^ResumableCallback)();
@interface RNFSDownloadParams : NSObject
@property (copy) NSString* fromUrl;
@property (copy) NSString* toFile;
@property (copy) NSDictionary* headers;
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
@property (copy) ResumableCallback resumableCallback; // Download has stopped but is resumable
2016-06-02 00:56:16 +01:00
@property bool background; // Whether to continue download when app is in background
2016-05-31 12:46:03 +03:00
@property (copy) NSNumber* progressDivider;
2016-06-02 00:56:16 +01:00
@end
@interface RNFSDownloader : NSObject <NSURLSessionDelegate, NSURLSessionDownloadDelegate>
2017-08-22 11:22:27 +03:00
- (NSString *)downloadFile:(RNFSDownloadParams*)params;
- (void)stopDownload;
- (void)resumeDownload;
- (BOOL)isResumable;
@end