archive

package
v0.0.0-...-25e8ccf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

ArchivePlugin

Extracts and creates archive files (zip, tar, gzip).

Type

ProcessPlugin

Version

1.0

Name

archive

Parameters

Parameter Required Type Default Description
action No string extract Action: extract or compress
file_path Extract string - Path to the archive file (for extraction)
source_path Compress string - Path to file/directory to compress
format Yes string - Archive format: zip, tar, or gzip
dest_path No string . Destination directory
archive_name No string auto-generated Output archive filename

Output

Extract
{
  "success": true
}
Compress
{
  "file_path": "/path/to/archive.zip",
  "size": 1024
}

On failure, returns an error message.

Usage Example

Extract
# Extract a zip file
- name: archive
  parameters:
    file_path: "/path/to/archive.zip"
    format: "zip"
    dest_path: "/path/to/output"

# Extract a tar.gz file
- name: archive
  parameters:
    file_path: "/path/to/archive.tar.gz"
    format: "tar"
    dest_path: "/path/to/output"

# Extract a gzip file
- name: archive
  parameters:
    file_path: "/path/to/file.gz"
    format: "gzip"
Compress
# Compress a single file to zip
- name: archive
  parameters:
    action: "compress"
    source_path: "/path/to/file.txt"
    format: "zip"
    dest_path: "/path/to/output"
    archive_name: "archive.zip"

# Compress a directory to tar.gz
- name: archive
  parameters:
    action: "compress"
    source_path: "/path/to/mydir"
    format: "tar"
    dest_path: "/path/to/output"

# Compress a single file to gzip
- name: archive
  parameters:
    action: "compress"
    source_path: "/path/to/file.txt"
    format: "gzip"
    dest_path: "/path/to/output"

Notes

  • For extract action: file_path is required
  • For compress action: source_path is required
  • tar format uses gzip compression (.tar.gz or .tgz)
  • gzip format only supports single files, not directories
  • When archive_name is not provided, it's auto-generated based on source name and format

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PluginSpec = types.PluginSpec{
	Name:    pluginName,
	Version: pluginVersion,
	Type:    types.TypeProcess,
}

Functions

func NewArchivePlugin

func NewArchivePlugin(ps types.PluginCall) types.Plugin

Types

type ArchivePlugin

type ArchivePlugin struct {
	// contains filtered or unexported fields
}

func (*ArchivePlugin) Name

func (p *ArchivePlugin) Name() string

func (*ArchivePlugin) Run

func (p *ArchivePlugin) Run(ctx context.Context, request *api.Request) (*api.Response, error)

func (*ArchivePlugin) Type

func (p *ArchivePlugin) Type() types.PluginType

func (*ArchivePlugin) Version

func (p *ArchivePlugin) Version() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL