FogMeta / meta-lib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

meta-lib

Features

Install

To install the latest version of meta-lib module:

go get github.com/FogMeta/meta-lib/

API Documentation

func GenerateCarFromFilesWithUuid(outputDir string, srcFiles []string, uuid []string, sliceSize int64) (carFile string, err error)

Parameters:

outputDir: directory where CAR file(s) will be generated.
srcFiles: file(s) where source file(s) is(are).
uuid: uuid(s) that corresponds to srcFiles
sliceSize: bytes of each piece (default: 17179869184)

Outputs:

carFile: the CAR which generated.

GenerateCarFromFilesWithUuid returns the CAR which generated from file(s) and uuid(s) which are specified by the srcFiles uuid and limited by sliceSize then output CAR to the specified directory outputDir.

func GenerateCarFromFiles(outputDir string, srcFiles []string, sliceSize int64) (carFile string, err error)

Parameters:

outputDir: directory where CAR file(s) will be generated.
srcFiles: file(s) where source file(s) is(are).
sliceSize: bytes of each piece (default: 17179869184)

Outputs:

carFile: the CAR which generated.

GenerateCarFromFiles returns the CAR which generated from the file(s) specified by the srcDir and limited by sliceSize then output CAR to the specified directory outputDir.

func GenerateCarFromDir(outputDir string, srcDir string, sliceSize int64) (carFile string, err error)

Parameters:

outputDir: directory where CAR file(s) will be generated.
srcDir: folder where source file(s) is(are) in.
sliceSize: bytes of each piece (default: 17179869184)

Outputs:

carFile: the CAR which generated.

GenerateCarFromDir returns the CAR which generated from the folder specified by the srcDir and limited by sliceSize then output CAR to the specified directory outputDir.

func GenerateCarFromDirEx(outputDir string, srcDir string, sliceSize int64, withUUID bool) ([]CarInfo, error)

Parameters:

outputDir: directory where CAR file(s) will be generated.
srcDir: folder where source file(s) is(are) in.
sliceSize: bytes of each piece (default: 17179869184)
withUUID: create uuid that corresponds to srcFiles

Outputs:

CarInfo: details of the source files included the CAR which generated .

GenerateCarFromDirEx returns the CAR which generated from the folder specified by the srcDir and limited by sliceSize then output CAR to the specified directory outputDir.

func GetCarRoot(destCar string) (cid string, err error)

Parameters:

destCar: the dest CAR file which want to get the root CID string.

Outputs:

cid: the root CID string of the destCar.

GetCarRoot returns the root CIDs of the CAR which is specified by the destCar.

func ListCarFile(destCar string) (info []string, err error)

Parameters:

destCar: the dest CAR file which want to get the root CID string.

Outputs:

info:list of FILE/CID/UUID/SIZE string(s).

ListCarFile returns list of FILE/CID/UUID/SIZE information in the CAR which is specified by the destCar.

func RestoreCar(outputDir string, srcCar string) (err error)

Parameters:

outputDir: directory where the original file(s) will be generated.
srcCar: the source CAR file witch restore from.

RestoreCar returns the original file(s) in the CAR which is specified by the srcCar, and output original file(s) to outputDir where specified by the parameter.

Examples

Here are examples for using meta-lib.

  • Generate CAR from file(s) and uuids which is(are) specified by the input directory. Example
  • Generate CAR from file(s) which is(are) specified by the input directory. Example
  • Generate CAR from a folder where source file(s) is(are) in. Example
  • Get root CID of a CAR. Example
  • List the FILE/CID/UUID/SIZE in a CAR. Example

Contribute

PRs are welcome!

License

Apache-2.0/MIT © Protocol Labs

About


Languages

Language:Go 99.9%Language:Makefile 0.1%