← All procedures

archive.extract

Extract a tar.gz or zip archive into a folder, with a check of each path

CLI
Package
@procedures/archive · README
Path
["archive","extract"]
CLI
mark archive extract --archive <string> --target <string>
As data
{"$proc":["archive","extract"],"input":{}}
Tags
archive, fs

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/archive/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["archive","extract"], { archive: "<archive>", target: "<target>" });
console.log(JSON.stringify(result));

From the command line

$ mark archive extract --archive <string> --target <string>

As data, in a program

{
  "$proc": ["archive", "extract"],
  "input": { "archive": "<archive>", "target": "<target>" }
}

Input

FieldTypeRequiredDefaultDescription
archivestringyesThe archive
targetstringyesThe folder that gets the content. The procedure makes it
format"tar.gz" | "tar" | "zip"noThe format (default: from the first bytes of the archive)
overwritebooleannoTrue: replace an existing file (default false: an existing file is an error, and nothing changes)

Output

FieldTypeRequiredDefaultDescription
targetstringyesThe absolute path of the target folder
format"tar.gz" | "tar" | "zip"yes
filesintegeryes
directoriesintegeryes
linksintegeryesThe symbolic links and the hard links
bytesintegeryesThe bytes of the files
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "archive": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4096,
        "description": "The archive"
      },
      "target": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4096,
        "description": "The folder that gets the content. The procedure makes it"
      },
      "format": {
        "description": "The format (default: from the first bytes of the archive)",
        "type": "string",
        "enum": [
          "tar.gz",
          "tar",
          "zip"
        ]
      },
      "overwrite": {
        "description": "True: replace an existing file (default false: an existing file is an error, and nothing changes)",
        "type": "boolean"
      }
    },
    "required": [
      "archive",
      "target"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "target": {
        "type": "string",
        "description": "The absolute path of the target folder"
      },
      "format": {
        "type": "string",
        "enum": [
          "tar.gz",
          "tar",
          "zip"
        ]
      },
      "files": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "directories": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "links": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991,
        "description": "The symbolic links and the hard links"
      },
      "bytes": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991,
        "description": "The bytes of the files"
      }
    },
    "required": [
      "target",
      "format",
      "files",
      "directories",
      "links",
      "bytes"
    ],
    "additionalProperties": false
  }
}