archive: add CompressLevel type and consts (MR 25)

There's really not a great way to map individual levels to each
compression library, so this just adds a new type that will invoke the
three relevant levels for each library used. This could be improved in
the future.
This commit is contained in:
Clayton Craft
2023-02-21 22:58:33 -08:00
parent 52fc741ba8
commit 1f4d8737e8

View File

@@ -29,6 +29,17 @@ const (
FormatZstd CompressFormat = "zstd"
)
type CompressLevel string
const (
// Mapped to the "default" level for the given format
LevelDefault CompressLevel = "default"
// Maps to the fastest compression level for the given format
LevelFast CompressLevel = "fast"
// Maps to the best compression level for the given format
LevelBest CompressLevel = "best"
)
type Archive struct {
items archiveItems
cpioWriter *cpio.Writer