04d914d403
By setting the buildtags "no_lzo" and/or "no_lzma", one can drop the library dependency on lzo and lzma. The same could be done for xz as well, but there are still lots of archives using xz compression out there.
20 lines
291 B
Go
20 lines
291 B
Go
//go:build !no_lzma
|
|
package decompress
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
|
|
"github.com/ulikunitz/xz/lzma"
|
|
)
|
|
|
|
type Lzma struct{}
|
|
|
|
func (l Lzma) Decompress(data []byte) ([]byte, error) {
|
|
rdr, err := lzma.NewReader(bytes.NewReader(data))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return io.ReadAll(rdr)
|
|
}
|