{"id":19620,"date":"2022-07-26T09:27:42","date_gmt":"2022-07-26T17:27:42","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=19620"},"modified":"2022-08-15T05:24:29","modified_gmt":"2022-08-15T13:24:29","slug":"archive-module-2-0-preview-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/archive-module-2-0-preview-1\/","title":{"rendered":"Archive Module 2.0 Preview 1"},"content":{"rendered":"<p dir=\"auto\">We are excited to announce that the first preview of a rewrite of <a href=\"https:\/\/www.powershellgallery.com\/packages\/Microsoft.PowerShell.Archive\" rel=\"nofollow\">Microsoft.PowerShell.Archive<\/a>, the module that lets you create and extract archives, is now available on the PowerShell Gallery.<\/p>\n<p dir=\"auto\">This release is the first preview release of a rewrite of the module and is not feature complete. Please note that this release only contains the <code>Compress-Archive<\/code>\u00a0cmdlet and is only compatible with PowerShell 7.3.0-preview5 and up. For more information on what is proposed in this rewrite, or to give feedback on the design please refer to the\u00a0<a href=\"https:\/\/github.com\/PowerShell\/Microsoft.PowerShell.Archive\/pull\/117\/files\">RFC<\/a>.<\/p>\n<h3 dir=\"auto\">Goals of the 2.0 release<\/h3>\n<p dir=\"auto\">The goal for the Archive module is to build a high-performing and maintainable module that offers high utility and works cross-platform (especially with regard to file paths).<\/p>\n<p dir=\"auto\">Currently, the archive module has a number of limitations. The module supports the zip32 format only. .NET 7 is planned to support the tar archive format, so there is an opportunity to support an additional archive format by taking advantage of these new APIs. Meanwhile, this opportunity can be leveraged not only to add tar support, but to rewrite the entire module in C# and address existing usability issues.<\/p>\n<p dir=\"auto\">The module has limited performance compared to other archive software. Although performance is dictated by the .NET APIs, a rewrite of the module in C# can reduce the overhead from script modules and address performance issues to an extent.<\/p>\n<p dir=\"auto\">The module has limited cross-platform support because archive entries are written in an OS-specific way due to different characters being used as directory separators in different OSs. This makes it difficult for Unix-based OS users to use archives compressed on a Windows computer or vice versa. The rewrite of the module can solve this problem by normalizing all paths to use Unix directory separators (the &#8216;\/&#8217; character) across all platforms.<\/p>\n<p dir=\"auto\">There are a number of issues in regard to using wildcard characters in paths. For example, in some cases, wildcard characters are not interpreted literally, which makes it difficult to use paths containing wildcard characters to specify the location of the archive.<\/p>\n<p dir=\"auto\">In some circumstances, error reporting can be improved and more descriptive. Compatibility with other archive software can also be improved as there are cases where an archive program may not recognize an archive produced by this module as valid. Interactions with other parts of PowerShell, such as the job system, advanced functions, and common parameters can be further improved, so that users can have a seamless experience when using the module.<\/p>\n<p dir=\"auto\">Additionally, .NET has supported creating large archives and compressing large files, but the archive module has lacked support for this. It makes sense to support archive formats that are supported by .NET, such as zip64 and tar, and to provide options that .NET also provides. The next version of the archive module, Microsoft.PowerShell.Archive v2.0.0, plans on resolving these limitations and usability issues.<\/p>\n<h3 dir=\"auto\">Installing the module<\/h3>\n<p dir=\"auto\">Please note that this release will only work with PowerShell 7.3.0-preview5 and up. Find and install the latest preview version of PowerShell\u00a0<a href=\"https:\/\/github.com\/PowerShell\/PowerShell#get-powershell\">here<\/a>.<\/p>\n<p dir=\"auto\">To install the Microsoft.PowerShell.Archive 2.0 preview 1 run the following command<\/p>\n<p dir=\"auto\"><code>Install-Module Microsoft.PowerShell.Archive -AllowPrerelease<\/code><\/p>\n<h3 dir=\"auto\">Features of the release<\/h3>\n<p dir=\"auto\">This release is not feature complete and only contains the rewrite of the\u00a0<code>Compress-Archive<\/code>\u00a0cmdlet.<\/p>\n<p dir=\"auto\">This cmdlet contains two parameter sets<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>    Compress-Archive [-Path] &lt;string[]&gt; [-DestinationPath] &lt;string&gt; [-WriteMode {Create | Update | Overwrite}] [-PassThru] [-CompressionLevel {Optimal | Fastest |\r\n    NoCompression | SmallestSize}] [-Format {zip}] [-WhatIf] [-Confirm] [&lt;CommonParameters&gt;]\r\n\r\n    Compress-Archive [-LiteralPath] &lt;string[]&gt; [-DestinationPath] &lt;string&gt; [-WriteMode {Create | Update | Overwrite}] [-PassThru] [-CompressionLevel {Optimal |\r\n    Fastest | NoCompression | SmallestSize}] [-Format {zip}] [-WhatIf] [-Confirm] [&lt;CommonParameters&gt;]\r\n<\/code><\/pre>\n<\/div>\n<p dir=\"auto\">Some features to note of this release<\/p>\n<ul dir=\"auto\">\n<li>Support for zip32 &amp; zip64<\/li>\n<li>Preserves relative path structure (when relative paths are specified)<\/li>\n<li>Improved performance from previous versions of the cmdlet<\/li>\n<li>New\u00a0<code>-WriteMode<\/code>\u00a0support in case of destination path collisions<\/li>\n<\/ul>\n<h3 dir=\"auto\">Features of the next release<\/h3>\n<p dir=\"auto\">The next release will focus in the\u00a0<code>Expand-Archive<\/code>\u00a0cmdlet. To track the progress of this release, look at\u00a0<a href=\"https:\/\/github.com\/PowerShell\/Microsoft.PowerShell.Archive\/projects\/2\">this project<\/a>\u00a0in our GitHub repository.<\/p>\n<h3 dir=\"auto\">Giving Feedback and Getting support<\/h3>\n<p dir=\"auto\">While we hope the new implementation provides a much better user experience, there are bound to be issues. Please let us know if you run into anything.<\/p>\n<p dir=\"auto\">If you encounter any issues with the module or have feature requests, the best place to get support is through our GitHub repository.<\/p>\n<p dir=\"auto\">Abdullah Yousuf<\/p>\n<p dir=\"auto\">Sydney Smith<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce that the first preview of a rewrite of Microsoft.PowerShell.Archive, the module that lets you create and extract archives, is now available on the PowerShell Gallery. This release is the first preview release of a rewrite of the module and is not feature complete. Please note that this release only contains [&hellip;]<\/p>\n","protected":false},"author":2299,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3185],"class_list":["post-19620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-archive-module"],"acf":[],"blog_post_summary":"<p>We are excited to announce that the first preview of a rewrite of Microsoft.PowerShell.Archive, the module that lets you create and extract archives, is now available on the PowerShell Gallery. This release is the first preview release of a rewrite of the module and is not feature complete. Please note that this release only contains [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/19620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/2299"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=19620"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/19620\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=19620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=19620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=19620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}