mirror of https://github.com/actions/toolkit
Support for extracting xar compatible archives
parent
ca65f538e9
commit
08fed982a7
|
@ -206,6 +206,30 @@ export async function extractTar(
|
|||
return dest
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a xar compatible archive
|
||||
*
|
||||
* @param file path to the archive
|
||||
* @param dest destination directory. Optional.
|
||||
* @param flags flags for the xar. Optional.
|
||||
* @returns path to the destination directory
|
||||
*/
|
||||
export async function extractXar(
|
||||
file: string,
|
||||
dest?: string,
|
||||
flags: string = '-x'
|
||||
): Promise<string> {
|
||||
if (!file) {
|
||||
throw new Error("parameter 'file' is required")
|
||||
}
|
||||
|
||||
dest = dest || (await _createExtractFolder(dest))
|
||||
const xarPath: string = await io.which('xar', true)
|
||||
await exec(`"${xarPath}"`, [flags, '-C', dest, '-f', file])
|
||||
|
||||
return dest
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a zip
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue