node-versions/helpers/nix-helpers.psm1
Maxim Lobanov 9f83a0c6de
Switch packages for Ubuntu & macOS to use tar.gz format instead of zip (#6)
Switch to using tar.gz format for Ubuntu and macOS systems because it is much more common on nix systems which is important in container scenarios
2020-04-23 18:42:48 +03:00

32 lines
854 B
PowerShell

<#
.SYNOPSIS
Unpack *.tar file
#>
function Extract-TarArchive {
param(
[Parameter(Mandatory=$true)]
[String]$ArchivePath,
[Parameter(Mandatory=$true)]
[String]$OutputDirectory
)
Write-Debug "Extract $ArchivePath to $OutputDirectory"
tar -C $OutputDirectory -xzf $ArchivePath --strip 1
}
function Create-TarArchive {
param(
[Parameter(Mandatory=$true)]
[String]$SourceFolder,
[Parameter(Mandatory=$true)]
[String]$ArchivePath,
[string]$CompressionType = "gz"
)
$CompressionTypeArgument = If ([string]::IsNullOrWhiteSpace($CompressionType)) { "" } else { "--${CompressionType}" }
Push-Location $SourceFolder
Write-Debug "tar -c $CompressionTypeArgument -f $ArchivePath ."
tar -c $CompressionTypeArgument -f $ArchivePath .
Pop-Location
}