-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
164 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""compress and extract file""" | ||
|
||
import gzip | ||
|
||
|
||
def compress_file_to_gzip(input_file, output_gz_file): | ||
""" | ||
Compresses a file using gzip. | ||
Args: | ||
input_file (str): The path of the input file. | ||
output_gz_file (str): The path of the output gzip file. | ||
""" | ||
with open(input_file, "rb") as file_in: | ||
with gzip.open(output_gz_file, "wb") as file_out: | ||
file_out.writelines(file_in) | ||
|
||
|
||
def extract_gz_file(input_gz_file, output_file): | ||
""" | ||
Extract the GZ file | ||
Args: | ||
input_gz_file (str): The path of the gzip input file. | ||
output_file (str): The path of the output file. | ||
""" | ||
with gzip.open(input_gz_file, "rb") as f_in: | ||
with open(output_file, "wb") as f_out: | ||
f_out.write(f_in.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.