Convert Figma logo to code with AI

mholt logoarchiver

DEPRECATED. Please use mholt/archives instead.

4,444
390
4,444
10

Quick Overview

Archiver is a cross-platform, multi-format archive utility and Go library. It provides a simple, unified interface for creating and extracting various archive formats, including zip, tar, rar, and 7-zip. The project aims to simplify working with archives in Go applications.

Pros

  • Supports multiple archive formats with a consistent API
  • Cross-platform compatibility
  • Actively maintained and well-documented
  • Provides both a command-line tool and a Go library

Cons

  • Some advanced features may be missing compared to format-specific tools
  • Performance may vary depending on the archive format
  • Limited support for certain less common archive formats

Code Examples

Creating a zip archive:

err := archiver.Archive([]string{"file1.txt", "file2.txt"}, "output.zip")
if err != nil {
    log.Fatal(err)
}

Extracting a tar archive:

err := archiver.Unarchive("archive.tar", "destination_folder")
if err != nil {
    log.Fatal(err)
}

Creating a custom archive format:

z := archiver.Zip{
    CompressionLevel:       flate.DefaultCompression,
    MkdirAll:               true,
    SelectiveCompression:   true,
    ContinueOnError:        false,
    OverwriteExisting:      false,
    ImplicitTopLevelFolder: false,
}
err := z.Archive([]string{"folder1", "folder2"}, "output.zip")
if err != nil {
    log.Fatal(err)
}

Getting Started

To use Archiver in your Go project, first install it:

go get -u github.com/mholt/archiver/v3

Then import it in your Go code:

import "github.com/mholt/archiver/v3"

Now you can use the archiver functions and types in your code. For example, to create a zip archive:

err := archiver.Archive([]string{"file1.txt", "file2.txt"}, "output.zip")
if err != nil {
    log.Fatal(err)
}

For more advanced usage and options, refer to the project's documentation on GitHub.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

archiver v4 alpha (DEPRECATED)

This package is no longer developed; it has been superceded by mholt/archives with an improved, more conventional exported API, significant performance improvements, and new features.

Thank you to all 71 contributors over the 8 years this version of the project was developed! It lives at mholt/archives.