Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Classes/NVHGzipFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ typedef NS_ENUM(NSInteger, NVHGzipFileErrorType)

@interface NVHGzipFile ()

@property (nonatomic,assign) CGFloat fileSizeFraction;

@end


Expand Down
40 changes: 20 additions & 20 deletions Classes/NVHTarGzip.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ - (BOOL)unTarGzipFileAtPath:(NSString *)sourcePath
toPath:(NSString *)destinationPath
error:(NSError **)error {
NSString *temporaryPath = [self temporaryFilePathForPath:sourcePath];
NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
[progress becomeCurrentWithPendingUnitCount:1];
// NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
// [progress becomeCurrentWithPendingUnitCount:1];
[self unGzipFileAtPath:sourcePath toPath:temporaryPath error:error];
[progress resignCurrent];
// [progress resignCurrent];
if (*error != nil) {
return NO;
}
[progress becomeCurrentWithPendingUnitCount:1];
// [progress becomeCurrentWithPendingUnitCount:1];
[self unTarFileAtPath:temporaryPath toPath:destinationPath error:error];
NSError *removeTemporaryFileError = nil;
[[NSFileManager defaultManager] removeItemAtPath:temporaryPath error:&removeTemporaryFileError];
Expand All @@ -63,7 +63,7 @@ - (BOOL)unTarGzipFileAtPath:(NSString *)sourcePath
*error = removeTemporaryFileError;
return NO;
}
[progress resignCurrent];
// [progress resignCurrent];
return YES;
}

Expand All @@ -85,14 +85,14 @@ - (BOOL)tarGzipFileAtPath:(NSString *)sourcePath
toPath:(NSString *)destinationPath
error:(NSError **)error {
NSString *temporaryPath = [self temporaryFilePathForPath:sourcePath];
NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
[progress becomeCurrentWithPendingUnitCount:1];
// NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
// [progress becomeCurrentWithPendingUnitCount:1];
[self tarFileAtPath:sourcePath toPath:temporaryPath error:error];
[progress resignCurrent];
// [progress resignCurrent];
if (*error != nil) {
return NO;
}
[progress becomeCurrentWithPendingUnitCount:1];
// [progress becomeCurrentWithPendingUnitCount:1];
[self gzipFileAtPath:temporaryPath toPath:destinationPath error:error];
NSError* removeCacheError = nil;
[[NSFileManager defaultManager] removeItemAtPath:temporaryPath error:&removeCacheError];
Expand All @@ -103,7 +103,7 @@ - (BOOL)tarGzipFileAtPath:(NSString *)sourcePath
*error = removeCacheError;
return NO;
}
[progress resignCurrent];
// [progress resignCurrent];
return YES;
}

Expand All @@ -125,19 +125,19 @@ - (void)unTarGzipFileAtPath:(NSString*)sourcePath
toPath:(NSString*)destinationPath
completion:(void(^)(NSError *))completion {
NSString *temporaryPath = [self temporaryFilePathForPath:sourcePath];
NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
[progress becomeCurrentWithPendingUnitCount:1];
// NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
// [progress becomeCurrentWithPendingUnitCount:1];
[self unGzipFileAtPath:sourcePath toPath:temporaryPath completion:^(NSError *gzipError) {
[progress resignCurrent];
// [progress resignCurrent];
if (gzipError != nil) {
completion(gzipError);
return;
}
[progress becomeCurrentWithPendingUnitCount:1];
// [progress becomeCurrentWithPendingUnitCount:1];
[self unTarFileAtPath:temporaryPath toPath:destinationPath completion:^(NSError *tarError) {
NSError* error = nil;
[[NSFileManager defaultManager] removeItemAtPath:temporaryPath error:&error];
[progress resignCurrent];
// [progress resignCurrent];
if (tarError != nil) {
error = tarError;
}
Expand All @@ -164,19 +164,19 @@ - (void)tarGzipFileAtPath:(NSString *)sourcePath
toPath:(NSString *)destinationPath
completion:(void(^)(NSError *))completion {
NSString *temporaryPath = [self temporaryFilePathForPath:destinationPath];
NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
[progress becomeCurrentWithPendingUnitCount:1];
// NSProgress *progress = [NSProgress progressWithTotalUnitCount:2];
// [progress becomeCurrentWithPendingUnitCount:1];
[self tarFileAtPath:sourcePath toPath:temporaryPath completion:^(NSError *tarError) {
[progress resignCurrent];
// [progress resignCurrent];
if (tarError != nil) {
completion(tarError);
return;
}
[progress becomeCurrentWithPendingUnitCount:1];
// [progress becomeCurrentWithPendingUnitCount:1];
[self gzipFileAtPath:temporaryPath toPath:destinationPath completion:^(NSError *gzipError) {
NSError *error = nil;
[[NSFileManager defaultManager] removeItemAtPath:temporaryPath error:&error];
[progress resignCurrent];
// [progress resignCurrent];
if (gzipError != nil) {
error = gzipError;
}
Expand Down
84 changes: 48 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Inflate Gzip file

```objective-c
[[NVHTarGzip shared] unGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* gzipError) {
[[NVHTarGzip sharedInstance] unGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* gzipError) {
if (gzipError != nil) {
NSLog(@"Error ungzipping %@", gzipError);
}
Expand All @@ -24,7 +24,7 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Untar file

```objective-c
[[NVHTarGzip shared] unTarFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* tarError) {
[[NVHTarGzip sharedInstance] unTarFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* tarError) {
if (tarError != nil) {
NSLog(@"Error untarring %@", tarError);
}
Expand All @@ -34,7 +34,7 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Inflate Gzip and Untar

```objective-c
[[NVHTarGzip shared] unTarGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* error) {
[[NVHTarGzip sharedInstance] unTarGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error extracting %@", error);
}
Expand All @@ -44,7 +44,7 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Deflate Gzip file

```objective-c
[[NVHTarGzip shared] gzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* gzipError) {
[[NVHTarGzip sharedInstance] gzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* gzipError) {
if (gzipError != nil) {
NSLog(@"Error gzipping %@", gzipError);
}
Expand All @@ -54,7 +54,7 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Tar file

```objective-c
[[NVHTarGzip shared] tarFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* tarError) {
[[NVHTarGzip sharedInstance] tarFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* tarError) {
if (tarError != nil) {
NSLog(@"Error tarring %@", tarError);
}
Expand All @@ -64,7 +64,7 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Deflate Gzip and Tar

```objective-c
[[NVHTarGzip shared] tarGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* error) {
[[NVHTarGzip sharedInstance] tarGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error packing %@", error);
}
Expand All @@ -77,61 +77,73 @@ The *tar* implementation is based on [Light-Untar-for-iOS](https://github.com/mh
#### Inflate Gzip file

```objective-c
[[NVHTarGzip shared] unGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* gzipError) {
if (gzipError != nil) {
NSLog(@"Error ungzipping %@", gzipError);
}
}];
NSError *error;
BOOL success = [[NVHTarGzip sharedInstance] unGzipFileAtPath:sourcePath toPath:destinationPath error:&error];
if (success) {
//continue
} else {
if (error) NSLog(@"Error ungzipping: %@", [error localizedDescription]);
}
```

#### Untar file

```objective-c
[[NVHTarGzip shared] unTarFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* tarError) {
if (tarError != nil) {
NSLog(@"Error untarring %@", tarError);
}
}];
NSError *error;
BOOL success = [[NVHTarGzip sharedInstance] unTarFileAtPath:sourcePath toPath:destinationPath error:&error];
if (success) {
//continue
} else {
if (error) NSLog(@"Error untarring: %@", [error localizedDescription]);
}
```

#### Inflate Gzip and Untar

```objective-c
[[NVHTarGzip shared] unTarGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error extracting %@", error);
}
}];
NSError *error;
BOOL success = [[NVHTarGzip sharedInstance] unTarGzipFileAtPath:sourcePath toPath:destinationPath error:&error];
if (success) {
//continue
} else {
if (error) NSLog(@"Error extracting: %@", [error localizedDescription]);
}
```

#### Deflate Gzip file

```objective-c
[[NVHTarGzip shared] gzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* gzipError) {
if (gzipError != nil) {
NSLog(@"Error gzipping %@", gzipError);
}
}];
NSError *error;
BOOL success = [[NVHTarGzip sharedInstance] gzipFileAtPath:sourcePath toPath:destinationPath error:&error];
if (success) {
//continue
} else {
if (error) NSLog(@"Error gzipping: %@", [error localizedDescription]);
}
```

#### Tar file

```objective-c
[[NVHTarGzip shared] tarFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* tarError) {
if (tarError != nil) {
NSLog(@"Error untarring %@", tarError);
}
}];
NSError *error;
BOOL success = [[NVHTarGzip sharedInstance] tarFileAtPath:sourcePath toPath:destinationPath error:&error];
if (success) {
//continue
} else {
if (error) NSLog(@"Error tarring: %@", [error localizedDescription]);
}
```

#### Deflate Gzip and Tar

```objective-c
[[NVHTarGzip shared] tarGzipFileAtPath:sourcePath toPath:destinationPath completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error extracting %@", error);
}
}];
NSError *error;
BOOL success = [[NVHTarGzip sharedInstance] tarGzipFileAtPath:sourcePath toPath:destinationPath error:&error];
if (success) {
//continue
} else {
if (error) NSLog(@"Error extracting: %@", [error localizedDescription]);
}
```

##### Note
Expand Down