RCTMultipartStreamReader.h 885 B

123456789101112131415161718192021
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <Foundation/Foundation.h>
  8. typedef void (^RCTMultipartCallback)(NSDictionary *headers, NSData *content, BOOL done);
  9. typedef void (^RCTMultipartProgressCallback)(NSDictionary *headers, NSNumber *loaded, NSNumber *total);
  10. // RCTMultipartStreamReader can be used to parse responses with Content-Type: multipart/mixed
  11. // See https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
  12. @interface RCTMultipartStreamReader : NSObject
  13. - (instancetype)initWithInputStream:(NSInputStream *)stream boundary:(NSString *)boundary;
  14. - (BOOL)readAllPartsWithCompletionCallback:(RCTMultipartCallback)callback
  15. progressCallback:(RCTMultipartProgressCallback)progressCallback;
  16. @end