@@ -64,7 +64,7 @@ - (id)initWithBridgeRef:(RCTBridge *)bridgeRef {
6464
6565// static member getter
6666+ (NSArray *) getFileStreams {
67-
67+
6868 if (fileStreams == nil )
6969 fileStreams = [[NSMutableDictionary alloc ] init ];
7070 return fileStreams;
@@ -115,12 +115,12 @@ + (NSString *) getPictureDir {
115115}
116116
117117+ (NSString *) getTempPath {
118-
118+
119119 return NSTemporaryDirectory ();
120120}
121121
122122+ (NSString *) getTempPath : (NSString *)taskId withExtension : (NSString *)ext {
123-
123+
124124 NSString * documentDir = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES ) firstObject ];
125125 NSString * filename = [NSString stringWithFormat: @" /RNFetchBlob_tmp/RNFetchBlobTmp_%@ " , taskId];
126126 if (ext != nil )
@@ -129,7 +129,7 @@ + (NSString *) getTempPath:(NSString*)taskId withExtension:(NSString *)ext {
129129 return tempPath;
130130}
131131
132- #pragma margk - readStream
132+ #pragma margk - readStream
133133
134134+ (void ) readStream : (NSString *)uri
135135 encoding : (NSString * )encoding
@@ -139,7 +139,7 @@ + (void) readStream:(NSString *)uri
139139 bridgeRef : (RCTBridge *)bridgeRef
140140{
141141 [[self class ] getPathFromUri: uri completionHandler: ^(NSString *path, ALAssetRepresentation *asset) {
142-
142+
143143 __block RCTEventDispatcher * event = bridgeRef.eventDispatcher ;
144144 __block int read = 0 ;
145145 __block int backoff = tick *1000 ;
@@ -193,7 +193,7 @@ + (void) readStream:(NSString *)uri
193193 // release buffer
194194 if (buffer != nil )
195195 free (buffer);
196-
196+
197197 }
198198 @catch (NSError * err)
199199 {
@@ -205,10 +205,10 @@ + (void) readStream:(NSString *)uri
205205 NSDictionary * payload = @{ @" event" : FS_EVENT_END, @" detail" : @" " };
206206 [event sendDeviceEventWithName: streamId body: payload];
207207 }
208-
208+
209209 }];
210-
211-
210+
211+
212212}
213213
214214// send read stream chunks via native event emitter
@@ -243,8 +243,8 @@ + (void) emitDataChunks:(NSData *)data encoding:(NSString *) encoding streamId:(
243243 NSDictionary * payload = @{ @" event" : FS_EVENT_DATA, @" detail" : asciiArray };
244244 [event sendDeviceEventWithName: streamId body: payload];
245245 }
246-
247-
246+
247+
248248}
249249
250250# pragma write file from file
@@ -274,7 +274,7 @@ + (NSNumber *) writeFileFromFile:(NSString *)src toFile:(NSString *)dest append:
274274 }
275275 else if (asset != nil )
276276 {
277-
277+
278278 __block NSOutputStream * os = [[NSOutputStream alloc ] initToFileAtPath: dest append: append];
279279 int read = 0 ;
280280 int cursor = 0 ;
@@ -293,7 +293,7 @@ + (NSNumber *) writeFileFromFile:(NSString *)src toFile:(NSString *)dest append:
293293 else
294294 callback (@" failed to resolve path" , nil );
295295 }];
296-
296+
297297 return 0 ;
298298}
299299
@@ -342,7 +342,7 @@ + (void) writeFile:(NSString *)path encoding:(NSString *)encoding data:(NSString
342342 [content writeToFile: path atomically: YES ];
343343 }
344344 fm = nil ;
345-
345+
346346 resolve ([NSNumber numberWithInteger: [content length ]]);
347347 }
348348 @catch (NSException * e)
@@ -423,16 +423,16 @@ + (void) readFile:(NSString *)path encoding:(NSString *)encoding
423423 else
424424 {
425425 if (![[NSFileManager defaultManager ] fileExistsAtPath: path]) {
426-
426+
427427 reject (@" RNFetchBlobFS readFile error" , @" file not exists" , nil );
428428 return ;
429429 }
430430 fileContent = [NSData dataWithContentsOfFile: path];
431-
431+
432432 }
433433 if (onComplete != nil )
434434 onComplete (fileContent);
435-
435+
436436 if ([[encoding lowercaseString ] isEqualToString: @" utf8" ]) {
437437 if (resolve != nil ) {
438438 NSString * utf8 = [[NSString alloc ] initWithData: fileContent encoding: NSUTF8StringEncoding];
@@ -480,7 +480,7 @@ + (BOOL) mkdir:(NSString *) path {
480480
481481+ (NSDictionary *) stat : (NSString *) path error : (NSError **) error {
482482
483-
483+
484484 BOOL isDir = NO ;
485485 NSFileManager * fm = [NSFileManager defaultManager ];
486486 if ([fm fileExistsAtPath: path isDirectory: &isDir] == NO ) {
@@ -498,7 +498,7 @@ + (NSDictionary *) stat:(NSString *) path error:(NSError **) error {
498498 @" lastModified" : [NSNumber numberWithLong: (time_t ) [lastModified timeIntervalSince1970 ]*1000 ],
499499 @" type" : isDir ? @" directory" : @" file"
500500 };
501-
501+
502502}
503503
504504# pragma mark - exists
@@ -584,7 +584,7 @@ - (void)closeOutStream {
584584 [self .outStream close ];
585585 self.outStream = nil ;
586586 }
587-
587+
588588}
589589
590590// Slice a file into another file, generally for support Blob implementation.
@@ -614,14 +614,14 @@ + (void)slice:(NSString *)path
614614 }
615615 long size = [fm attributesOfItemAtPath: path error: nil ].fileSize ;
616616 long max = MIN (size, [end longValue ]);
617-
617+
618618 if (![fm fileExistsAtPath: dest]) {
619619 [fm createFileAtPath: dest contents: @" " attributes: nil ];
620620 }
621621 [handle seekToFileOffset: [start longValue ]];
622622 while (read < expected)
623623 {
624-
624+
625625 NSData * chunk;
626626 long chunkSize = 0 ;
627627 if ([start longValue ] + read + 10240 > max)
@@ -639,7 +639,7 @@ + (void)slice:(NSString *)path
639639 if ([chunk length ] <= 0 )
640640 break ;
641641 long remain = expected - read;
642-
642+
643643 [os write: [chunk bytes ] maxLength: chunkSize];
644644 read += [chunk length ];
645645 }
@@ -656,10 +656,10 @@ + (void)slice:(NSString *)path
656656 [os open ];
657657 long size = asset.size ;
658658 long max = MIN (size, [end longValue ]);
659-
659+
660660 while (read < expected)
661661 {
662-
662+
663663 uint8_t * chunk[10240 ];
664664 long chunkSize = 0 ;
665665 if ([start longValue ] + read + 10240 > max)
@@ -677,7 +677,7 @@ + (void)slice:(NSString *)path
677677 if ( chunkRead <= 0 )
678678 break ;
679679 long remain = expected - read;
680-
680+
681681 [os write: chunk maxLength: chunkSize];
682682 read += chunkRead;
683683 }
@@ -688,7 +688,7 @@ + (void)slice:(NSString *)path
688688 {
689689 reject (@" slice error" , [NSString stringWithFormat: @" could not resolve URI %@ " , path ], nil );
690690 }
691-
691+
692692 }];
693693}
694694
@@ -701,7 +701,7 @@ - (void)closeInStream
701701 [[RNFetchBlobFS getFileStreams ] setValue: nil forKey: self .streamId];
702702 self.streamId = nil ;
703703 }
704-
704+
705705}
706706
707707
@@ -737,7 +737,7 @@ +(void) df:(RCTResponseSenderBlock)callback
737737 NSError *error = nil ;
738738 NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
739739 NSDictionary *dictionary = [[NSFileManager defaultManager ] attributesOfFileSystemForPath: [paths lastObject ] error: &error];
740-
740+
741741 if (dictionary) {
742742 NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize ];
743743 NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemFreeSize ];
@@ -750,7 +750,7 @@ +(void) df:(RCTResponseSenderBlock)callback
750750 } else {
751751 callback (@[@" failed to get storage usage." ]);
752752 }
753-
753+
754754}
755755
756756+ (void ) writeAssetToPath : (ALAssetRepresentation * )rep dest : (NSString *)dest
0 commit comments