← All procedures

archive.create

Make a tar.gz or zip archive of a folder or of files

CLI
Package
@procedures/archive · README
Path
["archive","create"]
CLI
mark archive create --output <string>
As data
{"$proc":["archive","create"],"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","create"], { output: "<output>" });
console.log(JSON.stringify(result));

From the command line

$ mark archive create --output <string>

As data, in a program

{ "$proc": ["archive", "create"], "input": { "output": "<output>" } }

Input

FieldTypeRequiredDefaultDescription
outputstringyesThe archive to make
sourcestringnoA folder: the archive gets its content
filesstring[]noFiles and folders, relative to cwd. A folder goes in with its content
cwdstringnoThe base folder of files (default: the working folder, or the root of the module)
format"tar.gz" | "tar" | "zip"noThe format (default: from the name of output: .tar.gz, .tgz, .tar or .zip)
overwritebooleannoTrue: replace an existing archive (default false)

Output

FieldTypeRequiredDefaultDescription
pathstringyesThe absolute path of the archive
format"tar.gz" | "tar" | "zip"yes
entriesintegeryesThe number of entries: files, folders and links
bytesintegeryesThe size of the archive, in bytes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "output": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4096,
        "description": "The archive to make"
      },
      "source": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4096,
        "description": "A folder: the archive gets its content"
      },
      "files": {
        "description": "Files and folders, relative to cwd. A folder goes in with its content",
        "minItems": 1,
        "maxItems": 10000,
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        }
      },
      "cwd": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4096,
        "description": "The base folder of files (default: the working folder, or the root of the module)"
      },
      "format": {
        "description": "The format (default: from the name of output: .tar.gz, .tgz, .tar or .zip)",
        "type": "string",
        "enum": [
          "tar.gz",
          "tar",
          "zip"
        ]
      },
      "overwrite": {
        "description": "True: replace an existing archive (default false)",
        "type": "boolean"
      }
    },
    "required": [
      "output"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The absolute path of the archive"
      },
      "format": {
        "type": "string",
        "enum": [
          "tar.gz",
          "tar",
          "zip"
        ]
      },
      "entries": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991,
        "description": "The number of entries: files, folders and links"
      },
      "bytes": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991,
        "description": "The size of the archive, in bytes"
      }
    },
    "required": [
      "path",
      "format",
      "entries",
      "bytes"
    ],
    "additionalProperties": false
  }
}