Skip to content

Commit

Permalink
docs: refine readme (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: l.feng <43399351+msclock@users.noreply.github.com>
  • Loading branch information
msclock authored Dec 30, 2024
1 parent ee75c3d commit 9bfb109
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ pip install pybit7z
from pybit7z import core

try:
extractor = core.Extractor(core.FormatSevenZip)
extractor = core.BitFileExtractor(core.FormatSevenZip)
extractor.extract("path/to/archive.7z", "out/dir/")

# Extracting a specific file inside an archive
extractor.extractMatching("path/to/archive.7z", "file.pdf", "out/dir/")
extractor.extract_matching("path/to/archive.7z", "file.pdf", "out/dir/")

# Extracting the first file of an archive to a buffer
buffer: bytes = extractor.extract("path/to/archive.7z")
Expand All @@ -66,7 +66,7 @@ from pybit7z import core

try:
# Opening the archive
archive = core.Bit7zArchiveReader("path/to/archive.gz", BitFormat::GZip)
archive = core.Bit7zArchiveReader("path/to/archive.gz", core.FormatGZip)

# Testing the archive
archive.test()
Expand Down Expand Up @@ -105,12 +105,12 @@ try:
compressor.compress_files(files, "protected_archive.zip")

# Updating an existing zip archive
compressor.set_update_mode(core.UpdateMode::Append)
compressor.set_update_mode(core.UpdateMode.Append)
compressor.compress_files(files, "existing_archive.zip")

# Compressing a single file into a buffer
compressor2 = core.BitFileCompressor(BitFormat::BZip2)
buffer: bytes = compressor2.compressFile(files[0])
compressor2 = core.BitFileCompressor(core.FormatBZip2)
buffer: bytes = compressor2.compress_file(files[0])
except core.BitException as e:
... # handle the exception
```
Expand Down Expand Up @@ -139,7 +139,7 @@ except core.BitException as e:
from pybit7z import core

try:
arc = core.BitArchiveReader("archive.7z", core.BitFormat::SevenZip)
arc = core.BitArchiveReader("archive.7z", core.FormatSevenZip)

# Printing archive metadata
print("Archive properties:",
Expand Down

0 comments on commit 9bfb109

Please sign in to comment.