File: uncompress_nocgo.go

package info (click to toggle)
golang-github-sassoftware-go-rpmutils 0.2.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 430 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// +build !cgo

package rpmutils

import (
	"io"

	"github.com/klauspost/compress/zstd"
)

func newZstdReader(r io.Reader) (io.ReadCloser, error) {
	decoder, err := zstd.NewReader(r)
	if err != nil {
		return nil, err
	}
	return zstdCloser{Decoder: decoder}, nil
}

// wrap Decoder so it implements io.Closer properly
type zstdCloser struct {
	*zstd.Decoder
}

func (d zstdCloser) Close() error {
	d.Decoder.Close()
	return nil
}