Açıklama Yok

RNFetchBlob.h 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // RNFetchBlob.h
  3. //
  4. // Created by wkh237 on 2016/4/28.
  5. //
  6. #ifndef RNFetchBlob_h
  7. #define RNFetchBlob_h
  8. #import <Foundation/Foundation.h>
  9. #import "RCTBridgeModule.h"
  10. // lib event
  11. extern NSString *const MSG_EVENT;
  12. extern NSString *const MSG_EVENT_LOG;
  13. extern NSString *const MSG_EVENT_WARN;
  14. extern NSString *const MSG_EVENT_ERROR;
  15. extern NSString *const FILE_PREFIX;
  16. // config
  17. extern NSString *const CONFIG_USE_TEMP;
  18. extern NSString *const CONFIG_FILE_PATH;
  19. extern NSString *const CONFIG_FILE_EXT;
  20. // fs events
  21. extern NSString *const FS_EVENT_DATA;
  22. extern NSString *const FS_EVENT_END;
  23. extern NSString *const FS_EVENT_WARN;
  24. extern NSString *const FS_EVENT_ERROR;
  25. @interface FetchBlobFS : NSObject <NSStreamDelegate> {
  26. NSOutputStream * outStream;
  27. NSInputStream * inStream;
  28. RCTResponseSenderBlock callback;
  29. RCTBridge * bridge;
  30. Boolean isOpen;
  31. NSString * encoding;
  32. int bufferSize;
  33. NSString * taskId;
  34. NSString * path;
  35. }
  36. @property (nonatomic) NSOutputStream * outStream;
  37. @property (nonatomic) NSInputStream * inStream;
  38. @property (nonatomic) RCTResponseSenderBlock callback;
  39. @property (nonatomic) RCTBridge * bridge;
  40. @property (nonatomic) NSString * encoding;
  41. @property (nonatomic) NSString * taskId;
  42. @property (nonatomic) NSString * path;
  43. @property (nonatomic) int bufferSize;
  44. + (NSString *) getTempPath;
  45. - (id) init;
  46. - (void) initWithCallback;
  47. - (void) initWithBridgeRef;
  48. - (void) openWithDestination;
  49. - (void) openWithId;
  50. - (void) write;
  51. - (void) read;
  52. - (void) closeInStream;
  53. - (void) closeOutStream;
  54. @end
  55. @interface FetchBlobUtils : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate> {
  56. NSString * taskId;
  57. int expectedBytes;
  58. int receivedBytes;
  59. NSMutableData * respData;
  60. RCTResponseSenderBlock callback;
  61. RCTBridge * bridge;
  62. NSDictionary * options;
  63. FetchBlobFS * fileStream;
  64. }
  65. @property (nonatomic) NSString * taskId;
  66. @property (nonatomic) int expectedBytes;
  67. @property (nonatomic) int receivedBytes;
  68. @property (nonatomic) NSMutableData * respData;
  69. @property (nonatomic) RCTResponseSenderBlock callback;
  70. @property (nonatomic) RCTBridge * bridge;
  71. @property (nonatomic) NSDictionary * options;
  72. @property (nonatomic) FetchBlobFS * fileStream;
  73. - (id) init;
  74. - (void) sendRequest;
  75. + (NSMutableDictionary *) normalizeHeaders;
  76. @end
  77. @interface RNFetchBlob : NSObject <RCTBridgeModule> {
  78. NSString * filePathPrefix;
  79. }
  80. @property (nonatomic) NSString * filePathPrefix;
  81. @end
  82. #endif /* RNFetchBlob_h */