An open API service indexing awesome lists of open source software.

https://github.com/nikhilsbhat/unpackker

utility to pack and unpack your asset
https://github.com/nikhilsbhat/unpackker

cli cloud-storages go-cli golang package unpackker-cli

Last synced: 27 days ago
JSON representation

utility to pack and unpack your asset

Awesome Lists containing this project

README

          

# unpackker

[![Go Report Card](https://goreportcard.com/badge/github.com/nikhilsbhat/unpackker)](https://goreportcard.com/report/github.com/nikhilsbhat/unpackker) [![shields](https://img.shields.io/badge/license-mit-brightgreen)](https://github.com/nikhilsbhat/unpackker/blob/master/LICENSE) [![PkgGoDev](https://pkg.go.dev/badge/github.com/nikhilsbhat/unpackker?tab=overview)](https://pkg.go.dev/github.com/nikhilsbhat/unpackker?tab=overview)

A utility to pack and unpack the files and folders that could be transported easily with less overhead.

## Introduction

This utility is no different to other tools that are available to zip and unzip assets. But this has major highlights such as its support for adding metadata, versioning and support of remote backend(cloud storage) for the zipped file or folder with programmatic access.

Only unpacker can understand the binary generated by [unpackker](https://github.com/nikhilsbhat/unpackker). Example on how to use client library can be found [here](https://github.com/nikhilsbhat/unpackker/blob/master/examples/unpacker/unpacker_fs.go). [Doc](https://pkg.go.dev/github.com/nikhilsbhat/unpackker/pkg/unpacker?tab=doc#NewConfig) on unpackker client library would give more insights on unpackker.

It is built with support of various other packages that are written in golang, predominantly [bindata](https://github.com/go-bindata/go-bindata).

## Requires

* Since there are no prebuilt libraries of Unpackker available, it expected that [go](https://golang.org/dl/) to be pre installed on the machine to build one. Installing go can be found [here](https://golang.org/doc/install).

## Installation

```golang
go get -u github.com/nikhilsbhat/unpackker
go build
```

Use the executable just like any other go-cli application.

Found some of the codes useful? then start using it by importing the package in your line of codes.

```golang
import (
"github.com/nikhilsbhat/unpackker"
)
```

### unpackker commands

```bash
unpackker [command] [flags]
```

Make sure appropriate command is used for the actions, to check the available commands and flags use `unpackker --help`

```bash
Unpackker helps user to pack or unpack the asset and store at the designated backend.

Usage:
unpackker [command] [flags]

Available Commands:
generate Command to generate package of the specified asset
help Help about any command
version Command to fetch the version of unpackker installed

Flags:
-a, --asset string path to asset which needs to be packed
-c, --config string path where the config file exists (default ".")
-e, --environment string name of environment in which the asset is packed
-h, --help help for unpackker
-n, --name string name of the asset that has to be created
-p, --path string path where the asset has to be created
-v, --version string version the asset that needs to be packed

Use "unpackker [command] --help" for more information about a command."
```

## Usage

### packing

There are multiple ways to pass parameters to unpackker-cli. This includes passing arguments to the flags while the cli is being invoked.
Even it supports config file, a file with all required parameters can be passed while invoking cli. It is a yaml file just like nay other tools seeks for.

The config file could be passed to `-c` flag of cli. By default unpackker seeks for file `.unpackker-config.yaml` in the directory where the cli was invoked.

### example

```bash
unpackker generate -c path/to/config.yaml
```

Sample config can be found under [example](https://github.com/nikhilsbhat/unpackker/tree/master/examples) in the repo.

**Note** unpackker cli flags always takes higher precedence over the configs specified under `.unpackker-config.yaml`.

### unpacking

Only unpackker's client library can understand the binary generated.
An example on how to use the unpackker's client library can be found [here](https://github.com/nikhilsbhat/unpackker/blob/master/examples/unpacker/unpacker_fs.go).

## `unpackker generate`

The command `generate` helps in generating the binary of specified files or folders.

```bash
unpackker generate
```

Pass the required falgs or use the config file as specified earlier to generate the binaries of the required assets.

```bash
# Before executing the below command, the assumption is that/
# Config file is used for other parameters and we are just overriding path in the below example.
unpackker generate -p /path/to/asset
```

## Limitations

Currently it just supports few cloud storages as a remote backend. GCP and AWS are supported at the moment.

## TODO

* [ ] Writing Tests
* [ ] API Reference Doc