- A CLI tools to interact with CAR file. Usage
- Generate CAR from files or folders.
- Get root CID of a CAR file.
- List original file(s) information in the CAR.
- Restore the original file(s) in the CAR.
To install the latest version of meta-lib
module:
go get github.com/FogMeta/meta-lib/
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
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
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
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
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
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
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.
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
PRs are welcome!
Apache-2.0/MIT © Protocol Labs