123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- //
- // RNFetchBlob.h
- //
- // Created by wkh237 on 2016/4/28.
- //
-
- #ifndef RNFetchBlob_h
- #define RNFetchBlob_h
- #import <Foundation/Foundation.h>
- #import "RCTBridgeModule.h"
-
- // lib event
- extern NSString *const MSG_EVENT;
- extern NSString *const MSG_EVENT_LOG;
- extern NSString *const MSG_EVENT_WARN;
- extern NSString *const MSG_EVENT_ERROR;
- extern NSString *const FILE_PREFIX;
-
- // config
- extern NSString *const CONFIG_USE_TEMP;
- extern NSString *const CONFIG_FILE_PATH;
- extern NSString *const CONFIG_FILE_EXT;
-
- // fs events
- extern NSString *const FS_EVENT_DATA;
- extern NSString *const FS_EVENT_END;
- extern NSString *const FS_EVENT_WARN;
- extern NSString *const FS_EVENT_ERROR;
-
- @interface FetchBlobFS : NSObject <NSStreamDelegate> {
- NSOutputStream * outStream;
- NSInputStream * inStream;
- RCTResponseSenderBlock callback;
- RCTBridge * bridge;
- Boolean isOpen;
- NSString * encoding;
- int bufferSize;
- NSString * taskId;
- NSString * path;
- }
-
- @property (nonatomic) NSOutputStream * outStream;
- @property (nonatomic) NSInputStream * inStream;
- @property (nonatomic) RCTResponseSenderBlock callback;
- @property (nonatomic) RCTBridge * bridge;
- @property (nonatomic) NSString * encoding;
- @property (nonatomic) NSString * taskId;
- @property (nonatomic) NSString * path;
- @property (nonatomic) int bufferSize;
-
- + (NSString *) getTempPath;
- - (id) init;
- - (void) initWithCallback;
- - (void) initWithBridgeRef;
- - (void) openWithDestination;
- - (void) openWithId;
- - (void) write;
- - (void) read;
- - (void) closeInStream;
- - (void) closeOutStream;
-
- @end
-
- @interface FetchBlobUtils : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate> {
-
- NSString * taskId;
- int expectedBytes;
- int receivedBytes;
- NSMutableData * respData;
- RCTResponseSenderBlock callback;
- RCTBridge * bridge;
- NSDictionary * options;
- FetchBlobFS * fileStream;
- }
- @property (nonatomic) NSString * taskId;
- @property (nonatomic) int expectedBytes;
- @property (nonatomic) int receivedBytes;
- @property (nonatomic) NSMutableData * respData;
- @property (nonatomic) RCTResponseSenderBlock callback;
- @property (nonatomic) RCTBridge * bridge;
- @property (nonatomic) NSDictionary * options;
- @property (nonatomic) FetchBlobFS * fileStream;
-
- - (id) init;
- - (void) sendRequest;
-
- + (NSMutableDictionary *) normalizeHeaders;
-
-
- @end
-
-
- @interface RNFetchBlob : NSObject <RCTBridgeModule> {
-
- NSString * filePathPrefix;
-
- }
-
- @property (nonatomic) NSString * filePathPrefix;
-
-
-
- @end
-
- #endif /* RNFetchBlob_h */
|