Path: blob/master/src/packages/frontend/editors/archive/misc.ts
1691 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45interface Entry {6list: { command: string; args: ReadonlyArray<string> };7extract: { command: string; args: ReadonlyArray<string> };8}910const bz2: Entry = {11list: { command: "ls", args: ["-l"] },12extract: { command: "bunzip2", args: ["-vf"] },13};1415const tbz2: Entry = {16list: { command: "tar", args: ["-jtvf"] },17extract: { command: "tar", args: ["-xjf"] },18};1920const tgz: Entry = {21list: { command: "tar", args: ["-tzf"] },22extract: { command: "tar", args: ["-xvzf"] },23};2425export const COMMANDS: { [type: string]: Entry } = {26"tar.bz2": tbz2,27tbz2: tbz2,28zip: {29list: { command: "unzip", args: ["-l"] },30extract: { command: "unzip", args: ["-B"] },31},32tar: {33list: { command: "tar", args: ["-tf"] },34extract: { command: "tar", args: ["-xvf"] },35},36tgz,37"tar.gz": tgz,38gz: {39list: { command: "gzip", args: ["-l"] },40extract: { command: "gunzip", args: ["-vf"] },41},42bz2,43bzip2: bz2,44lzip: {45list: { command: "ls", args: ["-l"] },46extract: { command: "lzip", args: ["-vfd"] },47},48xz: {49list: { command: "xz", args: ["-l"] },50extract: { command: "xz", args: ["-vfd"] },51},52} as const;5354// all keys of COMMANDS, that have at least one "." in their name55export const DOUBLE_EXT = Object.keys(COMMANDS).filter(56(key) => key.indexOf(".") >= 057);585960