6
6
7
7
#ifndef RNFetchBlob_h
8
8
#define RNFetchBlob_h
9
- #import < Foundation/Foundation.h>
10
9
#import " RCTBridgeModule.h"
11
10
12
- // lib event
13
- extern NSString *const MSG_EVENT;
14
- extern NSString *const MSG_EVENT_LOG;
15
- extern NSString *const MSG_EVENT_WARN;
16
- extern NSString *const MSG_EVENT_ERROR;
17
- extern NSString *const FILE_PREFIX;
18
-
19
- // config
20
- extern NSString *const CONFIG_USE_TEMP;
21
- extern NSString *const CONFIG_FILE_PATH;
22
- extern NSString *const CONFIG_FILE_EXT;
23
-
24
- // fs events
25
- extern NSString *const FS_EVENT_DATA;
26
- extern NSString *const FS_EVENT_END;
27
- extern NSString *const FS_EVENT_WARN;
28
- extern NSString *const FS_EVENT_ERROR;
29
-
30
- @interface FetchBlobFS : NSObject <NSStreamDelegate > {
31
- NSOutputStream * outStream;
32
- NSInputStream * inStream;
33
- RCTResponseSenderBlock callback;
34
- RCTBridge * bridge;
35
- Boolean isOpen;
36
- NSString * encoding;
37
- int bufferSize;
38
- BOOL appendData;
39
- NSString * taskId;
40
- NSString * path;
41
- NSString * streamId;
42
- }
43
-
44
- @property (nonatomic ) NSOutputStream * outStream;
45
- @property (nonatomic ) NSInputStream * inStream;
46
- @property (nonatomic ) RCTResponseSenderBlock callback;
47
- @property (nonatomic ) RCTBridge * bridge;
48
- @property (nonatomic ) NSString * encoding;
49
- @property (nonatomic ) NSString * taskId;
50
- @property (nonatomic ) NSString * path;
51
- @property (nonatomic ) int bufferSize;
52
- @property (nonatomic ) NSString * streamId;
53
- @property (nonatomic ) BOOL appendData;
54
-
55
- + (NSString *) getTempPath ;
56
- + (FetchBlobFS *) getFileStreams ;
57
- - (id ) init ;
58
- - (void ) initWithCallback ;
59
- - (void ) initWithBridgeRef ;
60
- - (void ) openWithDestination ;
61
- - (void ) openWithId ;
62
- - (NSString *) openWithPath ;
63
- - (void ) write ;
64
- - (void ) read ;
65
- - (void ) closeInStream ;
66
- - (void ) closeOutStream ;
67
-
68
- @end
69
-
70
- @interface FetchBlobUtils : NSObject <NSURLConnectionDelegate , NSURLConnectionDataDelegate > {
71
-
72
- NSString * taskId;
73
- int expectedBytes;
74
- int receivedBytes;
75
- NSMutableData * respData;
76
- RCTResponseSenderBlock callback;
77
- RCTBridge * bridge;
78
- NSDictionary * options;
79
- FetchBlobFS * fileStream;
80
- }
81
- @property (nonatomic ) NSString * taskId;
82
- @property (nonatomic ) int expectedBytes;
83
- @property (nonatomic ) int receivedBytes;
84
- @property (nonatomic ) NSMutableData * respData;
85
- @property (nonatomic ) RCTResponseSenderBlock callback;
86
- @property (nonatomic ) RCTBridge * bridge;
87
- @property (nonatomic ) NSDictionary * options;
88
- @property (nonatomic ) FetchBlobFS * fileStream;
89
-
90
-
91
- - (id ) init ;
92
- - (void ) sendRequest ;
93
-
94
- + (NSMutableDictionary *) normalizeHeaders ;
95
-
96
-
97
- @end
98
-
99
11
100
12
@interface RNFetchBlob : NSObject <RCTBridgeModule> {
101
13
@@ -106,7 +18,6 @@ extern NSString *const FS_EVENT_ERROR;
106
18
@property (nonatomic ) NSString * filePathPrefix;
107
19
108
20
109
-
110
21
@end
111
22
112
23
#endif /* RNFetchBlob_h */
0 commit comments