-
Native Zip Entry Objects
Zip entries returned by
Get-ZipEntry(and created byNew-ZipEntry) are now backed directly byICSharpCode.SharpZipLib.Zip.ZipEntry.
This exposes additional useful properties onZipEntryBasederived objects:IsEncrypted(bool) – Indicates whether the entry is encrypted.AESKeySize(int) – AES key size (0, 128, 192, or 256) if AES encryption is used.CompressionMethod(ICSharpCode.SharpZipLib.Zip.CompressionMethod) – The actual compression method used.Comment(string) – The entry comment.Crc(long) – Cyclic redundancy check.
-
Support for Encrypted Zip Entries
Get-ZipEntryContentandExpand-ZipEntrynow fully support reading and extracting password-protected entries.
A new common parameter has been added to both cmdlets:-Password <SecureString>
- If an entry is encrypted and no password is provided, the cmdlets will securely prompt for one.
- Examples and detailed guidance for handling encrypted entries have been added to the help documentation.
-
Documentation Improvements
All cmdlet help files have been reviewed and updated for consistency and clarity. Significant enhancements to
Get-ZipEntryContentandExpand-ZipEntryhelp:- Added dedicated examples demonstrating password-protected entry handling.
- Updated parameter descriptions and notes for the new
-Passwordparameter. - Improved phrasing, removed outdated example output, and ensured uniform formatting across the module.
- Added
AssemblyLoadContextsupport for PowerShell 7 (.NET 8.0 or later) to resolve DLL hell by isolating module dependencies. PowerShell 5.1 (.NET Framework) users can't get around this issue due to lack ofAssemblyLoadContextin that runtime.
-
Added commands supporting several algorithms to compress and decompress strings:
ConvertFrom-BrotliString&ConvertTo-BrotliString(using to BrotliSharpLib)ConvertFrom-DeflateString&ConvertTo-DeflateString(from CLR)ConvertFrom-ZlibString&ConvertTo-ZlibString(custom implementation)
-
Added commands for
.tarentry management with a reduced set of operations compared tozipentry management:Get-TarEntry: Lists entries, serving as the main entry point forTarEntrycmdlets.Get-TarEntryContent: Retrieves the content of a tar entry.Expand-TarEntry: Extracts a tar entry to a file.
-
Added commands to compress files and folders into
.tararchives and extract.tararchives with various compression algorithms:Compress-TarArchive&Expand-TarArchive: Supported compression algorithms includegz,bz2,zst,lz, andnone(no compression).
-
Removed commands:
Compress-GzipArchive&Expand-GzipArchive: These were deprecated as they only supported single-file compression, which is now better handled by the module’s.tararchive functionality. For a workaround to compress or decompress single files using gzip, see Example 2 inConvertTo-GzipString, which demonstrates using:
[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($path)) | ConvertFrom-GzipString
This update was made possible by the following projects. If you find them helpful, please consider starring their repositories:
- Code improvements.
- Instance methods
.OpenRead()and.OpenWrite()moved fromZipEntryFiletoZipEntryBase. - Adds support to list, read and extract zip archive entries from Stream.
- Update build process.
- Update
ci.ymlto usecodecov-action@v4. - Fixed parameter names in
Compress-ZipArchivedocumentation. Thanks to @martincostello. - Fixed coverlet.console support for Linux runner tests.
- Fixed a bug with
CompressionRatioproperty showing always in InvariantCulture format.
ZipEntryBaseType:- Renamed Property
EntryNametoName. - Renamed Property
EntryRelativePathtoRelativePath. - Renamed Property
EntryTypetoType. - Renamed Method
RemoveEntry()toRemove(). - Added Property
CompressionRatio.
- Renamed Property
ZipEntryFileType:- Added Property
Extension. - Added Property
BaseName.
- Added Property
ZipEntryDirectoryType:.NameProperty now reflects the directory entries name instead of an empty string.
- Added command
Rename-ZipEntry. NormalizePathMethod:- Moved from
[PSCompression.ZipEntryExtensions]::NormalizePathto[PSCompression.Extensions.PathExtensions]::NormalizePath.
- Moved from
Get-ZipEntrycommand:- Renamed Parameter
-EntryTypeto-Type.
- Renamed Parameter