en-US/PSCompression.dll-Help.xml
<?xml version="1.0" encoding="utf-8"?>
<helpItems schema="maml" xmlns="http://msh"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Expand-ZipEntry</command:name> <command:verb>Expand</command:verb> <command:noun>ZipEntry</command:noun> <maml:description> <maml:para>Expands Zip Archive Entries to a destination directory.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Expand-ZipEntry` cmdlet can expand zip entries outputted by the `Get-ZipEntry` (./Get-ZipEntry.md)command to a destination directory. Expanded entries maintain their original folder structure based on their relative path.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Expand-ZipEntry</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Destination</maml:name> <maml:description> <maml:para>The destination directory where to extract the Zip Entries. This parameter is optional, when not used, the entries are extracted to the their relative zip path in the current directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Existing files in the destination directory are overwritten when this switch is used.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>The cmdlet outputs the `FileInfo` and `DirectoryInfo` instances representing the extracted entries when this switch is used.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>The zip entries to expand.</maml:para> <maml:para>> [!NOTE] > > - This parameter takes input from pipeline, however binding by name is also possible. > - The input are instances inheriting from `ZipEntryBase` (`ZipEntryFile` or `ZipEntryDirectory`) outputted by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryBase[]</command:parameterValue> <dev:type> <maml:name>ZipEntryBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Destination</maml:name> <maml:description> <maml:para>The destination directory where to extract the Zip Entries. This parameter is optional, when not used, the entries are extracted to the their relative zip path in the current directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>$PWD</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Existing files in the destination directory are overwritten when this switch is used.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>The cmdlet outputs the `FileInfo` and `DirectoryInfo` instances representing the extracted entries when this switch is used.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>The zip entries to expand.</maml:para> <maml:para>> [!NOTE] > > - This parameter takes input from pipeline, however binding by name is also possible. > - The input are instances inheriting from `ZipEntryBase` (`ZipEntryFile` or `ZipEntryDirectory`) outputted by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryBase[]</command:parameterValue> <dev:type> <maml:name>ZipEntryBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>ZipEntryBase</maml:name> </dev:type> <maml:description> <maml:para>You can pipe instances of `ZipEntryFile` or `ZipEntryDirectory` to this cmdlet. These instances are produced by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>By default, this cmdlet produces no output.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>FileSystemInfo</maml:name> </dev:type> <maml:description> <maml:para>The cmdlet outputs the `FileInfo` and `DirectoryInfo` instances of the extracted entries when `-PassThru` switch is used.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Extract all `.txt` files from a Zip Archive to the current directory</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Include *.txt | Expand-ZipEntry</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Extract all `.txt` files from a Zip Archive to the a desired directory</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Include *.txt | Expand-ZipEntry -Destination path\to\myfolder</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Extract all entries excluding `.txt` files to the current directory</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Exclude *.txt | Expand-ZipEntry</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Extract all entries excluding `.txt` files to the current directory overwritting existing files</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Exclude *.txt | Expand-ZipEntry -Force</dev:code> <dev:remarks> <maml:para>Demonstrates how `-Force` switch works.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Extract all entries excluding `.txt` files to the current directory outputting the expanded entries</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Exclude *.txt | Expand-ZipEntry -PassThru</dev:code> <dev:remarks> <maml:para>By default this cmdlet produces no output. When `-PassThru` is used, this cmdlet outputs the `FileInfo` and `DirectoryInfo` instances representing the expanded entries.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/santisq/PSCompression</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-ZipEntry</command:name> <command:verb>Get</command:verb> <command:noun>ZipEntry</command:noun> <maml:description> <maml:para>Lists zip entries from one or more specified Zip Archives.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Get-ZipEntry` cmdlet lists entries from specified Zip paths. It has built-in functionalities to filter entries and is the main entry point for the `*-ZipEntry` cmdlets in this module.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-ZipEntry</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Type</maml:name> <maml:description> <maml:para>Lists entries of a specified type, `Archive` or `Directory`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Directory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Archive</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">ZipEntryType</command:parameterValue> <dev:type> <maml:name>ZipEntryType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none"> <maml:name>Exclude</maml:name> <maml:description> <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet lists entries. Any matching item is excluded from the output. Wildcard characters are accepted.</maml:para> <maml:para>> [!NOTE] > Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none"> <maml:name>Include</maml:name> <maml:description> <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet lists entries. Any matching item is included in the output. Wildcard characters are accepted.</maml:para> <maml:para>> [!NOTE] > Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="PSPath"> <maml:name>LiteralPath</maml:name> <maml:description> <maml:para>Specifies a path to one or more Zip compressed files. Note that the value is used exactly as it's typed. No characters are interpreted as wildcards.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-ZipEntry</maml:name> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies a path to one or more Zip compressed files. Wildcards are accepted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Type</maml:name> <maml:description> <maml:para>Lists entries of a specified type, `Archive` or `Directory`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Directory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Archive</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">ZipEntryType</command:parameterValue> <dev:type> <maml:name>ZipEntryType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none"> <maml:name>Exclude</maml:name> <maml:description> <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet lists entries. Any matching item is excluded from the output. Wildcard characters are accepted.</maml:para> <maml:para>> [!NOTE] > Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none"> <maml:name>Include</maml:name> <maml:description> <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet lists entries. Any matching item is included in the output. Wildcard characters are accepted.</maml:para> <maml:para>> [!NOTE] > Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Type</maml:name> <maml:description> <maml:para>Lists entries of a specified type, `Archive` or `Directory`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryType</command:parameterValue> <dev:type> <maml:name>ZipEntryType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none"> <maml:name>Exclude</maml:name> <maml:description> <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet lists entries. Any matching item is excluded from the output. Wildcard characters are accepted.</maml:para> <maml:para>> [!NOTE] > Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none"> <maml:name>Include</maml:name> <maml:description> <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet lists entries. Any matching item is included in the output. Wildcard characters are accepted.</maml:para> <maml:para>> [!NOTE] > Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="PSPath"> <maml:name>LiteralPath</maml:name> <maml:description> <maml:para>Specifies a path to one or more Zip compressed files. Note that the value is used exactly as it's typed. No characters are interpreted as wildcards.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="true" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies a path to one or more Zip compressed files. Wildcards are accepted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>String</maml:name> </dev:type> <maml:description> <maml:para>You can pipe paths to this cmdlet. Output from `Get-ChildItem` or `Get-Item` can be piped to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>ZipEntryDirectory</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>ZipEntryFile</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: List entries for a specified Zip file path ----</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: List entries from all Zip files in the current directory</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry *.zip</dev:code> <dev:remarks> <maml:para>The `-Path` parameter supports wildcards.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---- Example 3: List all `Archive` entries from a Zip file ----</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Type Archive</dev:code> <dev:remarks> <maml:para>The `-Type` parameter supports filtering by `Archive` or `Directory`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Filtering entries with `-Include` and `-Exclude` parameters</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry .\PSCompression.zip -Include PSCompression/docs/en-us* Directory: PSCompression/docs/en-US/ Type LastWriteTime CompressedSize Size Name ---- ------------- -------------- ---- ---- Directory 2/22/2024 1:19 PM 0.00 B 0.00 B en-US Archive 2/22/2024 1:19 PM 2.08 KB 6.98 KB Compress-GzipArchive.md Archive 2/22/2024 1:19 PM 2.74 KB 8.60 KB Compress-ZipArchive.md Archive 2/22/2024 1:19 PM 1.08 KB 2.67 KB ConvertFrom-GzipString.md Archive 2/22/2024 1:19 PM 1.67 KB 4.63 KB ConvertTo-GzipString.md Archive 2/22/2024 1:19 PM 1.74 KB 6.28 KB Expand-GzipArchive.md Archive 2/22/2024 1:19 PM 1.23 KB 4.07 KB Expand-ZipEntry.md Archive 2/22/2024 1:19 PM 1.53 KB 6.38 KB Get-ZipEntry.md Archive 2/22/2024 1:19 PM 1.67 KB 5.06 KB Get-ZipEntryContent.md Archive 2/22/2024 1:19 PM 2.20 KB 7.35 KB New-ZipEntry.md Archive 2/22/2024 1:19 PM 961.00 B 2.62 KB PSCompression.md Archive 2/22/2024 1:19 PM 1.14 KB 2.95 KB Remove-ZipEntry.md Archive 2/22/2024 1:19 PM 741.00 B 2.16 KB Rename-ZipEntry.md Archive 2/22/2024 1:19 PM 1.55 KB 5.35 KB Set-ZipEntryContent.md PS ..\pwsh> Get-ZipEntry .\PSCompression.zip -Include PSCompression/docs/en-us* -Exclude *en-US/Compress*, *en-US/Remove* Directory: PSCompression/docs/en-US/ Type LastWriteTime CompressedSize Size Name ---- ------------- -------------- ---- ---- Directory 2/22/2024 1:19 PM 0.00 B 0.00 B en-US Archive 2/22/2024 1:19 PM 1.08 KB 2.67 KB ConvertFrom-GzipString.md Archive 2/22/2024 1:19 PM 1.67 KB 4.63 KB ConvertTo-GzipString.md Archive 2/22/2024 1:19 PM 1.74 KB 6.28 KB Expand-GzipArchive.md Archive 2/22/2024 1:19 PM 1.23 KB 4.07 KB Expand-ZipEntry.md Archive 2/22/2024 1:19 PM 1.53 KB 6.38 KB Get-ZipEntry.md Archive 2/22/2024 1:19 PM 1.67 KB 5.06 KB Get-ZipEntryContent.md Archive 2/22/2024 1:19 PM 2.20 KB 7.35 KB New-ZipEntry.md Archive 2/22/2024 1:19 PM 961.00 B 2.62 KB PSCompression.md Archive 2/22/2024 1:19 PM 741.00 B 2.16 KB Rename-ZipEntry.md Archive 2/22/2024 1:19 PM 1.55 KB 5.35 KB Set-ZipEntryContent.md</dev:code> <dev:remarks> <maml:para>Inclusion and Exclusion patterns are applied to the entries relative path. Exclusions are applied after the inclusions.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/santisq/PSCompression</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-ZipEntryContent</command:name> <command:verb>Get</command:verb> <command:noun>ZipEntryContent</command:noun> <maml:description> <maml:para>Gets the content of a zip entry.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Get-ZipEntryContent` cmdlet gets the content of one or more `ZipEntryFile` instances. This cmdlet is meant to be used with `Get-ZipEntry` (./Get-ZipEntry.md)as your entry point.</maml:para> <maml:para>> [!TIP] > Entries outputted by `Get-ZipEntry` can be piped to this cmdlet.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-ZipEntryContent</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferSize</maml:name> <maml:description> <maml:para>This parameter determines the total number of bytes read into the buffer before outputting the stream of bytes. This parameter is applicable only when `-Raw` is not used. The buffer default value is 128 KiB.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>128000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Raw</maml:name> <maml:description> <maml:para>Ignores newline characters and returns the entire contents of an entry in one string with the newlines preserved. By default, newline characters in a file are used as delimiters to separate the input into an array of strings.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ZipEntry</maml:name> <maml:description> <maml:para>The entry or entries to get the content from. This parameter can be and is meant to be bound from pipeline however can be also used as a named parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryFile[]</command:parameterValue> <dev:type> <maml:name>ZipEntryFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsByteStream</maml:name> <maml:description> <maml:para>Specifies that the content should be read as a stream of bytes.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-ZipEntryContent</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encoding</maml:name> <maml:description> <maml:para>The character encoding used to read the entry content.</maml:para> <maml:para>> [!NOTE] > > - This parameter is applicable only when `-AsByteStream` is not used. > - The default encoding is `utf8NoBOM` .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue> <dev:type> <maml:name>Encoding</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>utf8NoBOM</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Raw</maml:name> <maml:description> <maml:para>Ignores newline characters and returns the entire contents of an entry in one string with the newlines preserved. By default, newline characters in a file are used as delimiters to separate the input into an array of strings.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ZipEntry</maml:name> <maml:description> <maml:para>The entry or entries to get the content from. This parameter can be and is meant to be bound from pipeline however can be also used as a named parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryFile[]</command:parameterValue> <dev:type> <maml:name>ZipEntryFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferSize</maml:name> <maml:description> <maml:para>This parameter determines the total number of bytes read into the buffer before outputting the stream of bytes. This parameter is applicable only when `-Raw` is not used. The buffer default value is 128 KiB.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>128000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encoding</maml:name> <maml:description> <maml:para>The character encoding used to read the entry content.</maml:para> <maml:para>> [!NOTE] > > - This parameter is applicable only when `-AsByteStream` is not used. > - The default encoding is `utf8NoBOM` .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue> <dev:type> <maml:name>Encoding</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>utf8NoBOM</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Raw</maml:name> <maml:description> <maml:para>Ignores newline characters and returns the entire contents of an entry in one string with the newlines preserved. By default, newline characters in a file are used as delimiters to separate the input into an array of strings.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ZipEntry</maml:name> <maml:description> <maml:para>The entry or entries to get the content from. This parameter can be and is meant to be bound from pipeline however can be also used as a named parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryFile[]</command:parameterValue> <dev:type> <maml:name>ZipEntryFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsByteStream</maml:name> <maml:description> <maml:para>Specifies that the content should be read as a stream of bytes.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>ZipEntryFile</maml:name> </dev:type> <maml:description> <maml:para>You can pipe instances of `ZipEntryFile` to this cmdlet. These instances are produced by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>String</maml:name> </dev:type> <maml:description> <maml:para>By default, this cmdlet returns the content as an array of strings, one per line. When the `-Raw` parameter is used, it returns a single string.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>Byte</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet returns the content as bytes when the `-AsByteStream` parameter is used.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Get the content of a Zip Archive Entry ------</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip -Include myrelative/entry.txt | Get-ZipEntryContent</dev:code> <dev:remarks> <maml:para>`-Include` parameter from `Get-ZipEntry` can be used to target a specific entry by passing the entry's relative path, from there the output can be piped directly to `Get-ZipEntryContent`. By default, the cmdlet streams line-by-line .</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------ Example 2: Get raw content of a Zip Archive Entry ------</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip -Include myrelative/entry.txt | Get-ZipEntryContent -Raw</dev:code> <dev:remarks> <maml:para>The cmdlet outputs a single multi-line string when the `-Raw` switch is used instead of line-by-line streaming.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>- Example 3: Get the bytes of a Zip Archive Entry as a Stream -</maml:title> <dev:code>PS ..pwsh\> $bytes = Get-ZipEntry .\test.zip -Include test/helloworld.txt | Get-ZipEntryContent -AsByteStream PS ..pwsh\> $bytes 104 101 108 108 111 32 119 111 114 108 100 33 13 10 PS ..pwsh\> [System.Text.Encoding]::UTF8.GetString($bytes) hello world!</dev:code> <dev:remarks> <maml:para>The `-AsByteStream` switch can be useful to read non-text zip entries.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 4: Get contents of all `.md` files as byte arrays --</maml:title> <dev:code>PS ..pwsh\> $bytes = Get-ZipEntry .\test.zip -Include *.md | Get-ZipEntryContent -AsByteStream -Raw PS ..pwsh\> $bytes[0].GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Byte[] System.Array PS ..pwsh\> $bytes[1].Length 7767</dev:code> <dev:remarks> <maml:para>When the `-Raw` and `-AsByteStream` switches are used together the cmdlet outputs `byte[]` as single objects for each zip entry.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/santisq/PSCompression</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-ZipEntry</command:name> <command:verb>New</command:verb> <command:noun>ZipEntry</command:noun> <maml:description> <maml:para>Creates zip entries from one or more specified entry relative paths.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `New-ZipEntry` cmdlet can create one or more Zip Archive Entries from specified paths. The type of the created entries is determined by their path, for example, if a path ends with `` or `/`, the entry will be created as a `Directory` entry, otherwise it will be an `Archive` entry.</maml:para> <maml:para>Entry paths, arguments of the `-EntryPath` parameter , are always normalized, a few examples of how paths are normalized:</maml:para> <maml:para>| Input | Normalized As | | ------------------------------ | --------------------------- | | `path\to\mynewentry.ext` | `path/to/mynewentry.ext` | | `\path\to\newdirectory` | `path/to/newdirectory/` | | `path\to\very/\random\/path\` | `path/to/very/random/path/` |</maml:para> <maml:para>> [!TIP] > The `[PSCompression.Extensions.PathExtensions]::NormalizePath(string path)` static method is available as a public API if you would like to normalize your paths before creating new entries.</maml:para> <maml:para>In addition, `New-ZipEntry` can set the content of the entries that it creates from string input or by specifying a source file path.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-ZipEntry</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Destination</maml:name> <maml:description> <maml:para>Specifies the path to a Zip file where to create the entries. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. Note that the value is used exactly as it's typed. No characters are interpreted as wildcards.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>EntryPath</maml:name> <maml:description> <maml:para>Specifies the path to one or more entries to create in the destination Zip file. The Type of the created entries is determined by their path , for example, if the path ends with `` or `/`, the entry will be created as a `Directory` entry, otherwise it will be an `Archive` entry.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionLevel</maml:name> <maml:description> <maml:para>Specifies values that indicate whether a compression operation emphasizes speed or compression size. See `CompressionLevel` Enum (https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.compressionlevel)for details.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Optimal</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Fastest</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NoCompression</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SmallestSize</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CompressionLevel</command:parameterValue> <dev:type> <maml:name>CompressionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Optimal</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encoding</maml:name> <maml:description> <maml:para>The character encoding used to set the entry content.</maml:para> <maml:para>> [!NOTE] > > - This parameter is applicable only when `-SourcePath` is not used. > - The default encoding is `utf8NoBOM` .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue> <dev:type> <maml:name>Encoding</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>utf8NoBOM</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>The cmdlet prevents creating entries in a destination Zip archive if an entry with the same relative path already exists. You can use the `-Force` parameter to overwrite them.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Value</maml:name> <maml:description> <maml:para>The string content that will be set to the created entries. You can also pipe a value to `New-ZipEntry`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-ZipEntry</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Destination</maml:name> <maml:description> <maml:para>Specifies the path to a Zip file where to create the entries. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. Note that the value is used exactly as it's typed. No characters are interpreted as wildcards.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>EntryPath</maml:name> <maml:description> <maml:para>Specifies the path to one or more entries to create in the destination Zip file. The Type of the created entries is determined by their path , for example, if the path ends with `` or `/`, the entry will be created as a `Directory` entry, otherwise it will be an `Archive` entry.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>SourcePath</maml:name> <maml:description> <maml:para>The path to the file to be archived. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionLevel</maml:name> <maml:description> <maml:para>Specifies values that indicate whether a compression operation emphasizes speed or compression size. See `CompressionLevel` Enum (https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.compressionlevel)for details.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Optimal</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Fastest</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NoCompression</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SmallestSize</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CompressionLevel</command:parameterValue> <dev:type> <maml:name>CompressionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Optimal</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>The cmdlet prevents creating entries in a destination Zip archive if an entry with the same relative path already exists. You can use the `-Force` parameter to overwrite them.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionLevel</maml:name> <maml:description> <maml:para>Specifies values that indicate whether a compression operation emphasizes speed or compression size. See `CompressionLevel` Enum (https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.compressionlevel)for details.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CompressionLevel</command:parameterValue> <dev:type> <maml:name>CompressionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Optimal</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Destination</maml:name> <maml:description> <maml:para>Specifies the path to a Zip file where to create the entries. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory. Note that the value is used exactly as it's typed. No characters are interpreted as wildcards.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encoding</maml:name> <maml:description> <maml:para>The character encoding used to set the entry content.</maml:para> <maml:para>> [!NOTE] > > - This parameter is applicable only when `-SourcePath` is not used. > - The default encoding is `utf8NoBOM` .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue> <dev:type> <maml:name>Encoding</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>utf8NoBOM</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>EntryPath</maml:name> <maml:description> <maml:para>Specifies the path to one or more entries to create in the destination Zip file. The Type of the created entries is determined by their path , for example, if the path ends with `` or `/`, the entry will be created as a `Directory` entry, otherwise it will be an `Archive` entry.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>The cmdlet prevents creating entries in a destination Zip archive if an entry with the same relative path already exists. You can use the `-Force` parameter to overwrite them.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>SourcePath</maml:name> <maml:description> <maml:para>The path to the file to be archived. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Value</maml:name> <maml:description> <maml:para>The string content that will be set to the created entries. You can also pipe a value to `New-ZipEntry`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>String</maml:name> </dev:type> <maml:description> <maml:para>You can pipe a value for the new zip entry to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>ZipEntryDirectory</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>ZipEntryFile</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>--------------- Example 1: Create empty entries ---------------</maml:title> <dev:code>PS ..\pwsh> New-ZipEntry .\test.zip -EntryPath test\entry, newfolder\ Directory: newfolder/ Type LastWriteTime CompressedSize Size Name ---- ------------- -------------- ---- ---- Directory 2/24/2024 3:22 PM 0.00 B 0.00 B newfolder Directory: test/ Type LastWriteTime CompressedSize Size Name ---- ------------- -------------- ---- ---- Archive 2/24/2024 3:22 PM 0.00 B 0.00 B entry</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 2: Create entries with content from input strings --</maml:title> <dev:code>PS ..\pwsh> 'hello', 'world', '!' | New-ZipEntry .\test.zip -EntryPath test\entry, newfolder\ New-ZipEntry: An entry with path 'test/entry' already exists in 'path\to\test.zip'. New-ZipEntry: An entry with path 'newfolder/' already exists in 'path\to\test.zip'. PS ..\pwsh> 'hello', 'world', '!' | New-ZipEntry .\test.zip -EntryPath test\entry, newfolder\ -Force PS ..\pwsh> Get-ZipEntry .\test.zip -Include test/entry | Get-ZipEntryContent hello world !</dev:code> <dev:remarks> <maml:para>The cmdlet prevents creating entries in a destination Zip archive if an entry with the same relative path already exists. You can use the `-Force` parameter to overwrite them.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create entries with content from a source file path</maml:title> <dev:code>PS ..\pwsh> $file = 'hello world!' | New-Item mytestfile.txt PS ..\pwsh> New-ZipEntry .\test.zip -EntryPath newentry.txt -SourcePath $file.FullName</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 4: Archive all files in a specified location -----</maml:title> <dev:code>PS ..\pwsh> $files = Get-ChildItem -File -Recurse PS ..\pwsh> $files | ForEach-Object { New-ZipEntry .\test.zip -EntryPath $_.FullName.Remove(0, $pwd.Path.Length) -SourcePath $_.FullName }</dev:code> <dev:remarks> <maml:para>In this example `$ .FullName.Remove(0, $pwd.Path.Length)` is used to get the file paths relative to the current location. Using `-EntryPath $ .FullName` without getting the relative paths would work too however this would cause issues while attempting to extract the files later.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Archive all `.txt` files in a specified location using a specified encoding</maml:title> <dev:code>PS ..\pwsh> $files = Get-ChildItem -File -Recurse -Filter *.txt PS ..\pwsh> $files | ForEach-Object { $_ | Get-Content -Encoding ascii | New-ZipEntry .\test.zip -EntryPath $_.FullName.Remove(0, $pwd.Path.Length) -Encoding ascii }</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/santisq/PSCompression</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-ZipEntry</command:name> <command:verb>Remove</command:verb> <command:noun>ZipEntry</command:noun> <maml:description> <maml:para>Removes zip entries from one or more zip archives.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Remove-ZipEntry` cmdlet can remove Zip Archive Entries from one or more Zip Archives. This cmdlet takes input from and is intended to be used in combination with the `Get-ZipEntry` (./Get-ZipEntry.md)cmdlet.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-ZipEntry</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>The entries that should be removed. This parameter can be and is meant to be bound from pipeline however can be also used as a named parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryBase[]</command:parameterValue> <dev:type> <maml:name>ZipEntryBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>The entries that should be removed. This parameter can be and is meant to be bound from pipeline however can be also used as a named parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryBase[]</command:parameterValue> <dev:type> <maml:name>ZipEntryBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>ZipEntryBase</maml:name> </dev:type> <maml:description> <maml:para>You can pipe instances of `ZipEntryFile` and `ZipEntryDirectory` to this cmdlet. These instances are produced by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet produces no output.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>- Example 1: Remove all Zip Archive Entries from a Zip Archive -</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip | Remove-ZipEntry</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Remove all `.txt` Entries from a Zip Archive ---</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip -Include *.txt | Remove-ZipEntry</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 3: Prompt for confirmation before removing entries --</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip -Include *.txt | Remove-ZipEntry -Confirm Confirm Are you sure you want to perform this action? Performing the operation "Remove" on target "test/helloworld.txt". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):</dev:code> <dev:remarks> <maml:para>This cmdlet supports `ShouldProcess` (https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-shouldprocess?view=powershell-7.3), you can prompt for confirmation before removing entries with `-Confirm` or check what the cmdlet would do without performing any action with `-WhatIf`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/santisq/PSCompression</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Rename-ZipEntry</command:name> <command:verb>Rename</command:verb> <command:noun>ZipEntry</command:noun> <maml:description> <maml:para>Renames zip entries from one or more zip archives.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Rename-ZipEntry` cmdlet changes the name of a specified item. This cmdlet does not affect the content of the item being renamed.</maml:para> <maml:para>> [!NOTE] > > - It's important to note that there is no API in the `System.IO.Compression` Namespace (https://learn.microsoft.com/en-us/dotnet/api/system.io.compression)to rename Zip Archive Entries, renaming an entry means creating a copy of the entry with a new name and deleting the old one. This is why the renaming operations can be slow on big Zip Archives. > - When renaming an entry that is of type `Directory` you need to consider that the operation explained in the previous point happens to every entry that is considered a child of the directory you are renaming.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Rename-ZipEntry</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>ZipEntry</maml:name> <maml:description> <maml:para>The zip entries to rename.</maml:para> <maml:para>> [!NOTE] > > - This parameter takes input from pipeline, however binding by name is also possible. > - The input are instances inheriting from `ZipEntryBase` (`ZipEntryFile` or `ZipEntryDirectory`) outputted by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryBase</command:parameterValue> <dev:type> <maml:name>ZipEntryBase</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>NewName</maml:name> <maml:description> <maml:para>Specifies the new name of the zip entry. Enter only a name, not a path and name.</maml:para> <maml:para>> [!TIP] > Delay-bind scriptblock (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.4#using-delay-bind-script-blocks-with-parameters) is supported for this parameter. See [Example 2](./Rename-ZipEntry.md#example-2-rename-all-entries-with-ext-extension-using-a-delay-bind-scriptblock).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>The cmdlet outputs the `ZipEntryFile` and `ZipEntryDirectory` instances representing the renamed entries when this switch is used.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>NewName</maml:name> <maml:description> <maml:para>Specifies the new name of the zip entry. Enter only a name, not a path and name.</maml:para> <maml:para>> [!TIP] > Delay-bind scriptblock (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.4#using-delay-bind-script-blocks-with-parameters) is supported for this parameter. See [Example 2](./Rename-ZipEntry.md#example-2-rename-all-entries-with-ext-extension-using-a-delay-bind-scriptblock).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>The cmdlet outputs the `ZipEntryFile` and `ZipEntryDirectory` instances representing the renamed entries when this switch is used.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>ZipEntry</maml:name> <maml:description> <maml:para>The zip entries to rename.</maml:para> <maml:para>> [!NOTE] > > - This parameter takes input from pipeline, however binding by name is also possible. > - The input are instances inheriting from `ZipEntryBase` (`ZipEntryFile` or `ZipEntryDirectory`) outputted by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryBase</command:parameterValue> <dev:type> <maml:name>ZipEntryBase</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>ZipEntryBase</maml:name> </dev:type> <maml:description> <maml:para>You can pipe instances of `ZipEntryFile` or `ZipEntryDirectory` to this cmdlet. These instances are produced by `Get-ZipEntry` (Get-ZipEntry.md) and [`New-ZipEntry`](New-ZipEntry.md)cmdlets.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>By default, this cmdlet produces no output.</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>ZipEntryFile</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>ZipEntryDirectory</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet outputs the renamed entries when the `-PassThru` switch is used.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- Example 1: Rename a Zip File Entry --------------</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip -Type Archive -Include relativePath/to/myEntryToRename.ext | Rename-ZipEntry -NewName myNewName.ext</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Rename all entries with `.ext` extension using a delay-bind scriptblock</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\myZip.zip -Type Archive -Include *.ext | Rename-ZipEntry -NewName { $_.BaseName + 'myNewName' + $_.Extension }</dev:code> <dev:remarks> <maml:para>Delay-bind scriptblocks (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.4#using-delay-bind-script-blocks-with-parameters)is supported for renaming multiple entries.</maml:para> <maml:para>> [!TIP] > In the context of the delay-bind scriptblock , `$_` (`$PSItem`) (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psitem?view=powershell-7.4)represents the current pipeline item, in this case, an instance of `PSCompression.ZipEntryFile` or `PSCompression.ZipEntryDirectory`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----------- Example 3: Rename a Zip Directory Entry -----------</maml:title> <dev:code>PS ..\pwsh> Get-ZipEntry .\PSCompression.zip -Include PSCompression/docs/en-US/* Directory: PSCompression/docs/en-US/ Type LastWriteTime CompressedSize Size Name ---- ------------- -------------- ---- ---- Directory 2/22/2024 1:19 PM en-US Archive 2/22/2024 1:19 PM 2.08 KB 6.98 KB Compress-GzipArchive.md Archive 2/22/2024 1:19 PM 2.74 KB 8.60 KB Compress-ZipArchive.md Archive 2/22/2024 1:19 PM 1.08 KB 2.67 KB ConvertFrom-GzipString.md Archive 2/22/2024 1:19 PM 1.67 KB 4.63 KB ConvertTo-GzipString.md Archive 2/22/2024 1:19 PM 1.74 KB 6.28 KB Expand-GzipArchive.md Archive 2/22/2024 1:19 PM 1.23 KB 4.07 KB Expand-ZipEntry.md Archive 2/22/2024 1:19 PM 1.53 KB 6.38 KB Get-ZipEntry.md Archive 2/22/2024 1:19 PM 1.67 KB 5.06 KB Get-ZipEntryContent.md Archive 2/22/2024 1:19 PM 2.20 KB 7.35 KB New-ZipEntry.md Archive 2/22/2024 1:19 PM 961.00 B 2.62 KB PSCompression.md Archive 2/22/2024 1:19 PM 1.14 KB 2.95 KB Remove-ZipEntry.md Archive 2/22/2024 1:19 PM 741.00 B 2.16 KB Rename-ZipEntry.md Archive 2/22/2024 1:19 PM 1.55 KB 5.35 KB Set-ZipEntryContent.md PS ..\pwsh> Get-ZipEntry .\PSCompression.zip -Include PSCompression/docs/en-US/ | Rename-ZipEntry -NewName 'en-US123' PS ..\pwsh> Get-ZipEntry .\PSCompression.zip -Include PSCompression/docs/en-US123/* Directory: PSCompression/docs/en-US123/ Type LastWriteTime CompressedSize Size Name ---- ------------- -------------- ---- ---- Directory 2/25/2024 12:41 PM en-US123 Archive 2/25/2024 12:41 PM 2.08 KB 6.98 KB Compress-GzipArchive.md Archive 2/25/2024 12:41 PM 2.74 KB 8.60 KB Compress-ZipArchive.md Archive 2/25/2024 12:41 PM 1.08 KB 2.67 KB ConvertFrom-GzipString.md Archive 2/25/2024 12:41 PM 1.67 KB 4.63 KB ConvertTo-GzipString.md Archive 2/25/2024 12:41 PM 1.74 KB 6.28 KB Expand-GzipArchive.md Archive 2/25/2024 12:41 PM 1.23 KB 4.07 KB Expand-ZipEntry.md Archive 2/25/2024 12:41 PM 1.53 KB 6.38 KB Get-ZipEntry.md Archive 2/25/2024 12:41 PM 1.67 KB 5.06 KB Get-ZipEntryContent.md Archive 2/25/2024 12:41 PM 2.20 KB 7.35 KB New-ZipEntry.md Archive 2/25/2024 12:41 PM 961.00 B 2.62 KB PSCompression.md Archive 2/25/2024 12:41 PM 1.14 KB 2.95 KB Remove-ZipEntry.md Archive 2/25/2024 12:41 PM 741.00 B 2.16 KB Rename-ZipEntry.md Archive 2/25/2024 12:41 PM 1.55 KB 5.35 KB Set-ZipEntryContent.md</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 4: Prompt for confirmation before renaming entries --</maml:title> <dev:code>PS ..pwsh\> Get-ZipEntry .\PSCompression.zip -Include PSCompression/docs/en-US123/ | Rename-ZipEntry -NewName 'Test' -Confirm Confirm Are you sure you want to perform this action? Performing the operation "Rename" on target "PSCompression/docs/en-US123/". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks /> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-ZipEntryContent</command:name> <command:verb>Set</command:verb> <command:noun>ZipEntryContent</command:noun> <maml:description> <maml:para>Sets or appends content to an existing zip entry.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The `Set-ZipEntryContent` cmdlet can write or append content to a Zip Archive Entry. By default, this cmdlet replaces the existing content of a Zip Archive Entry, if you need to append content you can use the `-Append` switch. This cmdlet also supports writing or appending raw bytes while using the `-AsByteStream` switch. To send content to `Set-ZipEntryContent` you can use the `-Value` parameter on the command line or send content through the pipeline.</maml:para> <maml:para>If you need to create a new Zip Archive Entry you can use the `New-ZipEntry` cmdlet (./New-ZipEntry.md).</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-ZipEntryContent</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>SourceEntry</maml:name> <maml:description> <maml:para>Specifies the zip archive entry that receives the content. `ZipEntryFile` instances can be obtained using `Get-ZipEntry` or `New-ZipEntry` cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryFile</command:parameterValue> <dev:type> <maml:name>ZipEntryFile</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Append</maml:name> <maml:description> <maml:para>Appends the content to the zip entry instead of overwriting it.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsByteStream</maml:name> <maml:description> <maml:para>Specifies that the content should be written as a stream of bytes.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferSize</maml:name> <maml:description> <maml:para>For efficiency purposes this cmdlet buffers bytes before writing them to the Zip Archive Entry. This parameter determines how many bytes are buffered before being written to the stream. > [!NOTE] > > - This parameter is applicable only when `-AsByteStream` is used. > The buffer default value is 128 KiB.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>128000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Outputs the object representing the updated zip archive entry. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Value</maml:name> <maml:description> <maml:para>Specifies the new content for the zip entry.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-ZipEntryContent</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>SourceEntry</maml:name> <maml:description> <maml:para>Specifies the zip archive entry that receives the content. `ZipEntryFile` instances can be obtained using `Get-ZipEntry` or `New-ZipEntry` cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryFile</command:parameterValue> <dev:type> <maml:name>ZipEntryFile</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Append</maml:name> <maml:description> <maml:para>Appends the content to the zip entry instead of overwriting it.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encoding</maml:name> <maml:description> <maml:para>The character encoding used to read the entry content.</maml:para> <maml:para>> [!NOTE] > > - This parameter is applicable only when `-AsByteStream` is not used. > - The default encoding is `utf8NoBOM` .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue> <dev:type> <maml:name>Encoding</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>utf8NoBOM</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Outputs the object representing the updated zip archive entry. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Value</maml:name> <maml:description> <maml:para>Specifies the new content for the zip entry.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Append</maml:name> <maml:description> <maml:para>Appends the content to the zip entry instead of overwriting it.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsByteStream</maml:name> <maml:description> <maml:para>Specifies that the content should be written as a stream of bytes.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferSize</maml:name> <maml:description> <maml:para>For efficiency purposes this cmdlet buffers bytes before writing them to the Zip Archive Entry. This parameter determines how many bytes are buffered before being written to the stream. > [!NOTE] > > - This parameter is applicable only when `-AsByteStream` is used. > The buffer default value is 128 KiB.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>128000</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encoding</maml:name> <maml:description> <maml:para>The character encoding used to read the entry content.</maml:para> <maml:para>> [!NOTE] > > - This parameter is applicable only when `-AsByteStream` is not used. > - The default encoding is `utf8NoBOM` .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Encoding</command:parameterValue> <dev:type> <maml:name>Encoding</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>utf8NoBOM</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Outputs the object representing the updated zip archive entry. By default, this cmdlet does not generate any output.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>SourceEntry</maml:name> <maml:description> <maml:para>Specifies the zip archive entry that receives the content. `ZipEntryFile` instances can be obtained using `Get-ZipEntry` or `New-ZipEntry` cmdlets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ZipEntryFile</command:parameterValue> <dev:type> <maml:name>ZipEntryFile</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Value</maml:name> <maml:description> <maml:para>Specifies the new content for the zip entry.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Object[]</command:parameterValue> <dev:type> <maml:name>Object[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Object</maml:name> </dev:type> <maml:description> <maml:para>You can pipe strings or bytes to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet produces no output by default .</maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>ZipEntryFile</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet outputs the updated entry when the `-PassThru` switch is used.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert /> </maml:alertSet> <command:examples> <command:example> <maml:title>----- Example 1: Write new content to a Zip Archive Entry -----</maml:title> <dev:code>PS ..pwsh\> $entry = New-ZipEntry .\test.zip -EntryPath test\helloworld.txt PS ..pwsh\> 'hello', 'world', '!' | Set-ZipEntryContent $entry PS ..pwsh\> $entry | Get-ZipEntryContent hello world !</dev:code> <dev:remarks> <maml:para>You can send content through the pipeline or using the `-Value` parameter as shown in the next example.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------- Example 2: Append content to a Zip Archive Entry -------</maml:title> <dev:code>PS ..pwsh\> Set-ZipEntryContent $entry -Value 'hello', 'world', '!' -Append PS ..pwsh\> $entry | Get-ZipEntryContent hello world ! hello world !</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------ Example 3: Write raw bytes to a Zip Archive Entry ------</maml:title> <dev:code>PS ..pwsh\> $entry = Get-ZipEntry .\test.zip -Include test/helloworld.txt PS ..pwsh\> $bytes = [System.Text.Encoding]::UTF8.GetBytes('hello world!') PS ..pwsh\> $bytes | Set-ZipEntryContent $entry -AsByteStream PS ..pwsh\> $entry | Get-ZipEntryContent hello world!</dev:code> <dev:remarks> <maml:para>The cmdlet supports writing and appending raw bytes while using the `-AsByteStream` switch.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------ Example 4: Append raw bytes to a Zip Archive Entry ------</maml:title> <dev:code>PS ..pwsh\> $bytes | Set-ZipEntryContent $entry -AsByteStream -Append PS ..pwsh\> $entry | Get-ZipEntryContent hello world!hello world!</dev:code> <dev:remarks> <maml:para>Using the same byte array in the previous example, we can append bytes to the entry stream.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://github.com/santisq/PSCompression</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems> |