Documentation ¶
Index ¶
- func Compress(input []byte, fileName string) ([]byte, error)
- func Decompress(input []byte) (output []byte, fileName string, e error)
- func Decrypt(input []byte, password string) (output []byte, e error)
- func Encrypt(input []byte, password string) (output []byte, e error)
- func GetCRC32(fileName string) (uint32, error)
- func GetDecompressedSize(fileName string) (uint32, error)
- func GetGzipCRC32(fileName string) (uint32, error)
- func PackArray(input []string) ([]byte, error)
- func PackFolder(input string) ([]byte, error)
- func ReadFile(fileName string) ([]byte, error)
- func Unpack(input []byte, output string) error
- func WriteFile(filePath string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compress ¶
Compress compress bytes array of file into another bytes array.
fileName could include relative file path. It is stored in the header of the compressed file.
This param is important to preserve the original name of the file when uncompressed.
Example: Compress(filedata, "folder/uncompressedfile.ext")
func Decompress ¶
Decompress decompress bytes array of file into another bytes array.
func Decrypt ¶
Decrypt decrypts input []byte] into output []byte using the password. This function uses AES256 algorithm (mode GCM).
func Encrypt ¶
Encrypt encrypts input []byte into output []byte using the password. This function uses AES256 algorithm (mode GCM).
Password lenght can be any not zero value. The password is processed by the SHA256 hash algorithm to generate a 256-bit key.
func GetDecompressedSize ¶ added in v0.4.0
GetDecompressedSize gets decompresed size of the gzip file.
func GetGzipCRC32 ¶ added in v0.4.0
GetGzipCRC32 gets crc32 checksum of decompressed file stored in gzip file (fileName)
func PackArray ¶ added in v0.6.0
PackArray packs folders and files of input string array into an array of bytes. This array can be used to write a tar file, or to process in another function.
Example: PackArray([]string{"myfolder/file.txt", "myfolder/folder2"}) returns []byte of the packed file
func PackFolder ¶
PackFolder packs input folder into an array of bytes. This array can be used to write a tar file, or to process in another function.
Example: PackFolder("user/projectsfolder") returns []byte of the packed file
func Unpack ¶
Unpack extracts all files []byte of the input tar file to output path.
Example: Unpack(fileBytesArray, "unpackedfolders/folder1")
Types ¶
This section is empty.